[cc'ing Heinz and the linux-raid mailing list] On Thu, Sep 21 2023 at 4:34P -0400, Kirill Kirilenko <kirill@xxxxxxxxxxxxxx> wrote: > Hello. > > I created two LVM physical volumes: one on NVMe device and one on SATA SSD. > I added them to a volume group and created a logical RAID1 volume in it. > Then I enabled 'writemostly' flag on the second (slowest) PV. > And my system started to freeze at random times with no messages in syslog. > I was able to determine that the freezing was happening during execution of > 'fstrim' (via systemd timer). I checked this by running 'fstrim' manually. > If I disable the 'writemostly' flag, I experience no freezes. I can > reproduce this behavior on vanilla 6.5.0 kernel. > > My LV is 150 GB ext4 volume, and it has lots of files in it, so running > 'fstrim' takes around a minute. This may be important. > > Additional information: > OS: Linux Mint 21.2 > CPU: AMD Ryzen 7 5800X > NVMe: Samsung SSD 980 500GB > SATA SSD: Samsung SSD 850 EVO M.2 250GB > > Best regards, > Kirill Kirilenko. > I just verified that 6.5.0 does have this DM core fix (needed to prevent excessive splitting of discard IO.. which could cause fstrim to take longer for a DM device), but again 6.5.0 has this fix so it isn't relevant: be04c14a1bd2 dm: use op specific max_sectors when splitting abnormal io Given your use of 'writemostly' I'm inferring you're using lvm2's raid1 that uses MD raid1 code in terms of the dm-raid target. Discards (more generic term for fstrim) are considered writes, so writemostly really shouldn't matter... but I know that there have been issues with MD's writemostly code (identified by others relatively recently). All said: hopefully someone more MD oriented can review your report and help you further. Mike