[PATCH] mdadm: Incremental mode creates file for udev rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux