mdadm named array (metadata 1.2) and udev when assembling an array in initramfs
Hi Stephen,
thanks for the bug report.
This patch should fix it.
NeilBrown
From 628cdf19ea35daad22e409e51c0abc7ffb19d6aa Mon Sep 17 00:00:00 2001
From: NeilBrown <[email protected]>
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.
mapfile.c +10 -3
@@ -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 )
Quoted 38 lines · NeilBrown
Hi Stephen,
thanks for the bug report.
This patch should fix it.NeilBrown
From
628cdf19ea35daad22e409e51c0abc7ffb19d6aaMon Sep 17 00:00:00 2001
From: NeilBrown <[email protected]>
Date: Mon, 3 Nov 2014 12:49:05 +1100
Subject: [PATCH] Rebuildmap: strip local host name from device name.When
/run/mdadm/mapis 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 <[email protected]>Signed-off-by NeilBrown <[email protected]>mapfile.c +4
-3@@ -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. */
mapfile.c void RebuildMap(void) · line 473
Quoted 10 lines
mapfile.c +6
-0+if (homehost && unum ==-1 && +strncmp (name, homehost, +strlen (homehost)) ==0 && + name[strlen (homehost)] ==':' ) + name +=strlen (homehost)+1 ; unum =-1 ; + }while (conflict) {if (unum >=0 )
Your patch works for me! Thanks so much for taking a look.
Stephen
Quoted 47 lines · On Sun, 2 Nov 2014 20:16:34 -0800 Stephen Kent <[email protected]> wrote:
Quoted 46 lines · NeilBrown
Hi Stephen,
thanks for the bug report.
This patch should fix it.NeilBrown
From
628cdf19ea35daad22e409e51c0abc7ffb19d6aaMon Sep 17 00:00:00 2001
From: NeilBrown <[email protected]>
Date: Mon, 3 Nov 2014 12:49:05 +1100
Subject: [PATCH] Rebuildmap: strip local host name from device name.When
/run/mdadm/mapis 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 <[email protected]>Signed-off-by NeilBrown <[email protected]>mapfile.c +10
-3@@ -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 ; + }
Quoted 6 lines
mapfile.c void RebuildMap(void) · line 473
Quoted 2 lines
mapfile.c +0
-0while (conflict) {if (unum >=0 )Your patch works for me! Thanks so much for taking a look.
Great - thanks for the confirmation. It will be in the next release.
NeilBrown