diff mbox series

[blktests,v3] dm/002: add --retry option to dmsetup remove command

Message ID 20240723045855.304279-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series [blktests,v3] dm/002: add --retry option to dmsetup remove command | expand

Commit Message

Shinichiro Kawasaki July 23, 2024, 4:58 a.m. UTC
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.

When udev opens the dm device, "dmsetup remove" command also tries to
open the device and fails with EBUSY. To avoid the failure, add the
--retry option to the dmsetup command.

Suggested-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
This patch addresses a failure found during the debug work for another
dm/002 failure [1].

[1] https://lore.kernel.org/linux-block/42ecobcsduvlqh77iavjj2p3ewdh7u4opdz4xruauz4u5ddljz@yr7ye4fq72tr/

Changes from v2:
* "dmsetup remove --retry " instead of "udevadm settle"
Changes from v1:
* "udevadm settle" instead of retrying "dmsetup remove"

 tests/dm/002 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig July 24, 2024, 3:34 p.m. UTC | #1
I've also occasionally seen this, and the patch seems to fix the issue:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Nitesh Shetty July 24, 2024, 6:29 p.m. UTC | #2
On 23/07/24 01:58PM, 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.
>
>When udev opens the dm device, "dmsetup remove" command also tries to
>open the device and fails with EBUSY. To avoid the failure, add the
>--retry option to the dmsetup command.
>
>Suggested-by: Milan Broz <gmazyland@gmail.com>
>Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>---
>This patch addresses a failure found during the debug work for another
>dm/002 failure [1].
>
>[1] https://lore.kernel.org/linux-block/42ecobcsduvlqh77iavjj2p3ewdh7u4opdz4xruauz4u5ddljz@yr7ye4fq72tr/
>
Tested-by: Nitesh Shetty <nj.shetty@samsung.com>

>Changes from v2:
>* "dmsetup remove --retry " instead of "udevadm settle"
>Changes from v1:
>* "udevadm settle" instead of retrying "dmsetup remove"
>
> tests/dm/002 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/tests/dm/002 b/tests/dm/002
>index fae3986..ea3f684 100755
>--- a/tests/dm/002
>+++ b/tests/dm/002
>@@ -37,7 +37,7 @@ test_device() {
> 	sync
> 	dmsetup message dust1 0 countbadblocks
> 	sync
>-	dmsetup remove dust1
>+	dmsetup remove --retry dust1 |& grep -v "Device or resource busy"
>
> 	echo "Test complete"
> }
>-- 
>2.45.2
>
Shinichiro Kawasaki July 30, 2024, 2:06 a.m. UTC | #3
On Jul 23, 2024 / 13:58, 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.
> 
> When udev opens the dm device, "dmsetup remove" command also tries to
> open the device and fails with EBUSY. To avoid the failure, add the
> --retry option to the dmsetup command.
> 
> Suggested-by: Milan Broz <gmazyland@gmail.com>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

Thanks for the review and the test. I have applied the patch.
diff mbox series

Patch

diff --git a/tests/dm/002 b/tests/dm/002
index fae3986..ea3f684 100755
--- a/tests/dm/002
+++ b/tests/dm/002
@@ -37,7 +37,7 @@  test_device() {
 	sync
 	dmsetup message dust1 0 countbadblocks
 	sync
-	dmsetup remove dust1
+	dmsetup remove --retry dust1 |& grep -v "Device or resource busy"
 
 	echo "Test complete"
 }