]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Incremental.c
config: add 'homehost' option to 'AUTO' line.
[thirdparty/mdadm.git] / Incremental.c
index 8c686f7e8e6bde1d426d8731f3bdeca8a9d5c1d3..7ad648a336d8de576afda3e83226037649fa2a71 100644 (file)
@@ -221,26 +221,30 @@ int Incremental(char *devname, int verbose, int runstop,
                return 1;
        }
 
-       if (!match && !conf_test_metadata(st->ss->name)) {
-               if (verbose >= 1)
-                       fprintf(stderr, Name
-                               ": %s has metadata type %s for which "
-                               "auto-assembly is disabled\n",
-                               devname, st->ss->name);
-               return 1;
-       }
-
        /* 3a/ if not, check for homehost match.  If no match, continue
         * but don't trust the 'name' in the array. Thus a 'random' minor
         * number will be assigned, and the device name will be based
         * on that. */
        if (match)
                trustworthy = LOCAL;
-       else if ((homehost == NULL ||
-                 st->ss->match_home(st, homehost) != 1) &&
-                st->ss->match_home(st, "any") != 1)
-               trustworthy = FOREIGN;
+       else if (st->ss->match_home(st, homehost) == 1)
+               trustworthy = LOCAL;
+       else if (st->ss->match_home(st, "any") == 1)
+               trustworthy = LOCAL_ANY;
        else
+               trustworthy = FOREIGN;
+
+
+       if (!match && !conf_test_metadata(st->ss->name,
+                                         (trustworthy == LOCAL))) {
+               if (verbose >= 1)
+                       fprintf(stderr, Name
+                               ": %s has metadata type %s for which "
+                               "auto-assembly is disabled\n",
+                               devname, st->ss->name);
+               return 1;
+       }
+       if (trustworthy == LOCAL_ANY)
                trustworthy = LOCAL;
 
        /* There are three possible sources for 'autof':  command line,