[PATCH] Create /dev/md/x link when md device is created

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

 



After the /dev/mdx is created,we can see that /dev/mdx file is
created.When we reboot machines,we found /dev/md/x will be created,
and map file will be rebuild and changed.

During RAID rebuild after the reboot, we found /dev/md/x is created
with high priority. To consistent behavior, we think that /dev/md/x
should also be created when creating devices.

We modified the logic for creating /dev/mdx,creating /dev/md/x at
the same time.

Signed-off-by: miaoguanqin <miaoguanqin@xxxxxxxxxx>
Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
---
 mdopen.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/mdopen.c b/mdopen.c
index 98c54e4..d128396 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -373,11 +373,12 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,

 	sprintf(devname, "/dev/%s", devnm);

-	if (dev && dev[0] == '/')
-		strcpy(chosen, dev);
-	else if (cname[0] == 0)
-		strcpy(chosen, devname);
-
+	if (strncmp(chosen, "/dev/md/", 8) != 0) {
+		if (dev && dev[0] == '/')
+			strcpy(chosen, dev);
+		else if (cname[0] == 0)
+			strcpy(chosen, devname);
+	}
 	/* We have a device number and name.
 	 * If we cannot detect udev, we need to make
 	 * devices and links ourselves.
--
2.33.0




[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