On Jul 19, 2024 / 09:14, Milan Broz wrote: > On 7/19/24 6:23 AM, Shin'ichiro Kawasaki wrote: > > The test case dm/002 rarely fails with the message below: > > > > dm/002 => nvme0n1 (dm-dust general functionality test) [failed] > > runtime 0.204s ... 0.174s > > --- tests/dm/002.out 2024-06-14 14:37:40.480794693 +0900 > > +++ /home/shin/Blktests/blktests/results/nvme0n1/dm/002.out.bad 2024-06-14 21:38:18.588976499 +0900 > > @@ -7,4 +7,6 @@ > > countbadblocks: 0 badblock(s) found > > countbadblocks: 3 badblock(s) found > > countbadblocks: 0 badblock(s) found > > +device-mapper: remove ioctl on dust1 failed: Device or resource busy > > +Command failed. > > Test complete > > modprobe: FATAL: Module dm_dust is in use. > > > > This failure happens when udev opens the dm device at "dmsetup remove" > > command. To avoid the failure, call "udevadm settle" before the "dmsetup > > remove" command. > > I think udevadm settle is overkill as it waits for everything, not only that device. > > Did you consider to use "dmsetup remove --retry <dev>"? This is one > liner and you do not need to implement the retry yourself. > > We have many such situations in cryptsetup tests and --retry was enough > to fix it (as the busy comes usually from blkid scan that is fast enough). > It will print a few benign messages while retrying, though. > > (Just a hint, I am not nacking the patch :) Thanks Milan, I was not aware of the --retry option. I confirmed it avoids the failure. I think it's the better than "udevadm settle". Will post v3.