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

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