Thread (3 messages) 3 messages, 2 authors, 2014-11-03

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

From: NeilBrown <hidden>
Date: 2014-11-03 05:43:25

On Sun, 2 Nov 2014 20:16:34 -0800 Stephen Kent [off-list ref] wrote:
On Sun, Nov 2, 2014 at 5:50 PM, NeilBrown [off-list ref] wrote:
quoted
Hi Stephen,
 thanks for the bug report.
This patch should fix it.

NeilBrown

From 628cdf19ea35daad22e409e51c0abc7ffb19d6aa Mon Sep 17 00:00:00 2001
From: NeilBrown <redacted>
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 <redacted>
Signed-off-by: NeilBrown <redacted>
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)

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

Attachments

  • (unnamed) [application/pgp-signature] 828 bytes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help