]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mapfile.c
tests: raid6 repair is now tested on every different layout.
[thirdparty/mdadm.git] / mapfile.c
index 149f67b2e4e2417e308b68477354225a43d63866..41599df05f979c22136b0084bca1f776ed15f0c5 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
@@ -46,7 +46,6 @@
 #include       <sys/file.h>
 #include       <ctype.h>
 
-
 #define MAP_READ 0
 #define MAP_NEW 1
 #define MAP_LOCK 2
@@ -105,7 +104,6 @@ int map_write(struct map_ent *mel)
                      mapname[0]) == 0;
 }
 
-
 static FILE *lf = NULL;
 int map_lock(struct map_ent **melp)
 {
@@ -416,11 +414,11 @@ void RebuildMap(void)
                                 * It needs to match what -I or -As would come
                                 * up with.
                                 * That means:
-                                *   Check if array is in mdadm.conf 
+                                *   Check if array is in mdadm.conf
                                 *        - if so use that.
                                 *   determine trustworthy from homehost etc
                                 *   find a unique name based on metadata name.
-                                *   
+                                *
                                 */
                                struct mddev_ident *match = conf_match(st, info,
                                                                       NULL, 0,
@@ -457,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)