Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] mdadm: Incremental mode creates file for udev rules
@ 2025-03-25 19:18 Nigel Croxon
  2025-03-26  2:31 ` Xiao Ni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nigel Croxon @ 2025-03-25 19:18 UTC (permalink / raw)
  To: linux-raid, mariusz.tkaczyk, Xiao Ni


Mounting an md device may fail during boot from mdadm's claim
on the device not being released before systemd attempts to mount.

While mdadm is still constructing the array (mdadm --incremental
that is called from within /usr/lib/udev/rules.d/64-md-raid-assembly.rules),
there is an attempt to mount the md device, but there is not a creation
of "/run/mdadm/creating-xxx" file when in incremental mode that
the rule is looking for.  Therefore the device is not marked
as SYSTEMD_READY=0  in
"/usr/lib/udev/rules.d/01-md-raid-creating.rules" and missing
synchronization using the "/run/mdadm/creating-xxx" file.

Enable creating the "/run/mdadm/creating-xxx" file during
incremental mode.

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
---
  Incremental.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Incremental.c b/Incremental.c
index 228d2bdd..e0d3fce7 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -30,6 +30,7 @@

  #include	"mdadm.h"
  #include	"xmalloc.h"
+#include	"udev.h"

  #include	<sys/wait.h>
  #include	<dirent.h>
@@ -286,7 +287,7 @@ int Incremental(struct mddev_dev *devlist, struct 
context *c,

  		/* Couldn't find an existing array, maybe make a new one */
  		mdfd = create_mddev(match ? match->devname : NULL, name_to_use, 
trustworthy,
-				    chosen_name, 0);
+				    chosen_name, 1);

  		if (mdfd < 0)
  			goto out_unlock;
@@ -599,6 +600,7 @@ int Incremental(struct mddev_dev *devlist, struct 
context *c,
  		rv = 0;
  	}
  out:
+	udev_unblock();
  	free(avail);
  	if (dfd >= 0)
  		close(dfd);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-26 17:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 19:18 [PATCH] mdadm: Incremental mode creates file for udev rules Nigel Croxon
2025-03-26  2:31 ` Xiao Ni
2025-03-26  8:00 ` Paul Menzel
2025-03-26  9:15   ` Paul Menzel
2025-03-26 12:48 ` Mariusz Tkaczyk
2025-03-26 17:36   ` Nigel Croxon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox