Blame SOURCES/0046-tests-00readonly-Run-udevadm-settle-before-setting-r.patch

25786b
From 39b381252c32275079344d30de18b76fda4bba26 Mon Sep 17 00:00:00 2001
25786b
From: Logan Gunthorpe <logang@deltatee.com>
25786b
Date: Wed, 27 Jul 2022 15:52:45 -0600
91179e
Subject: [PATCH 46/83] tests/00readonly: Run udevadm settle before setting ro
25786b
25786b
In some recent kernel versions, 00readonly fails with:
25786b
25786b
  mdadm: failed to set readonly for /dev/md0: Device or resource busy
25786b
  ERROR: array is not read-only!
25786b
25786b
This was traced down to a race condition with udev holding a reference
25786b
to the block device at the same time as trying to set it read only.
25786b
25786b
To fix this, call udevadm settle before setting the array read only.
25786b
25786b
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
25786b
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
25786b
---
25786b
 tests/00readonly | 1 +
25786b
 1 file changed, 1 insertion(+)
25786b
25786b
diff --git a/tests/00readonly b/tests/00readonly
25786b
index 39202487..afe243b3 100644
25786b
--- a/tests/00readonly
25786b
+++ b/tests/00readonly
25786b
@@ -12,6 +12,7 @@ do
25786b
 			$dev1 $dev2 $dev3 $dev4 --assume-clean
25786b
 		check nosync
25786b
 		check $level
25786b
+		udevadm settle
25786b
 		mdadm -ro $md0
25786b
 		check readonly
25786b
 		state=$(cat /sys/block/md0/md/array_state)
25786b
-- 
91179e
2.38.1
25786b