Re: mdadm named array (metadata 1.2) and udev when assembling an array in initramfs

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

 



Hi Stephen,
 thanks for the bug report.
This patch should fix it.

NeilBrown

From 628cdf19ea35daad22e409e51c0abc7ffb19d6aa Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@xxxxxxx>
Date: Mon, 3 Nov 2014 12:49:05 +1100
Subject: [PATCH] Rebuildmap: strip local host name from device name.

When /run/mdadm/map is being rebuilt, e.g. by "mdadm -Ir",
if the device doesn't exist in /dev, we have to choose
a name.
Currently we don't strip the hostname which is wrong if
it is the local host.

Reported-by: Stephen Kent <smkent@xxxxxxxxxx>
Signed-off-by: NeilBrown <neilb@xxxxxxx>

diff --git a/mapfile.c b/mapfile.c
index 4e7f24214b8a..41599df05f97 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -455,12 +455,19 @@ void RebuildMap(void)
 							sep = "";
 						}
 					}
-					if (strchr(name, ':'))
-						/* probably a uniquifying
+					if (strchr(name, ':')) {
+						/* Probably a uniquifying
 						 * hostname prefix.  Allow
-						 * without a suffix
+						 * without a suffix, and strip
+						 * hostname if it is us.
 						 */
+						if (homehost && unum == -1 &&
+						    strncmp(name, homehost,
+							    strlen(homehost)) == 0 &&
+						    name[strlen(homehost)] == ':')
+							name += strlen(homehost)+1;
 						unum = -1;
+					}
 
 					while (conflict) {
 						if (unum >= 0)

Attachment: pgpwpSpPPcCz1.pgp
Description: OpenPGP digital signature


[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