Hey, The first commit is a new race condition seen with more recent md/md-next kernels. udevadm settle needs to be called in a test to avoid the race. The second patch I have already sent a couple times[1], but have reworked it based on feedback from Mariusz. The new version of the patch keeps the checks on the device if it already exists but changes them so it doesn't require openning the device (which has annoying side effects). Logan [1] https://lkml.kernel.org/r/20220714223749.17250-1-logang@xxxxxxxxxxxx -- Logan Gunthorpe (2): tests/00readonly: Run udevadm settle before setting ro mdadm: Don't open md device for CREATE and ASSEMBLE lib.c | 12 ++++++++++++ mdadm.c | 40 ++++++++++++++++++++-------------------- mdadm.h | 1 + tests/00readonly | 1 + 4 files changed, 34 insertions(+), 20 deletions(-) -- 2.30.2