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

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