]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Incremental: fix some handling of trustworthy.
authorNeilBrown <neilb@suse.de>
Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)
1/ if homehost matches, then we need to set trustworthy to 'LOCAL'
2/ if we decide to set trustworthy to 'METADATA' because we have to
   use the metadata version name, do that *after* we have checked if
   we are going to assemble within a container, as inside the
   container there could be different sources of names to use.

Signed-off-by: NeilBrown <neilb@suse.de>
Incremental.c

index e293999e404805aa3bd0a66ad9c4ab2fe6ec30ed..f8a5d326d8be27148d4e8aa698fb490fdef24f7b 100644 (file)
@@ -220,19 +220,8 @@ int Incremental(char *devname, int verbose, int runstop,
        else if (homehost == NULL ||
                 st->ss->match_home(st, homehost) != 1)
                trustworthy = FOREIGN;
-       name_to_use = strchr(info.name, ':');
-       if (name_to_use)
-               name_to_use++;
        else
-               name_to_use = info.name;
-
-       if ((!name_to_use || name_to_use[0] == 0) &&
-           info.array.level == LEVEL_CONTAINER &&
-           trustworthy == LOCAL) {
-               name_to_use = info.text_version;
-               trustworthy = METADATA;
-       }
-
+               trustworthy = LOCAL;
 
        /* There are three possible sources for 'autof':  command line,
         * ARRAY line in mdadm.conf, or CREATE line in mdadm.conf.
@@ -251,6 +240,19 @@ int Incremental(char *devname, int verbose, int runstop,
                return Incremental_container(st, devname, verbose, runstop,
                                             autof, trustworthy);
        }
+       name_to_use = strchr(info.name, ':');
+       if (name_to_use)
+               name_to_use++;
+       else
+               name_to_use = info.name;
+
+       if ((!name_to_use || name_to_use[0] == 0) &&
+           info.array.level == LEVEL_CONTAINER &&
+           trustworthy == LOCAL) {
+               name_to_use = info.text_version;
+               trustworthy = METADATA;
+       }
+
        /* 4/ Check if array exists.
         */
        map_lock(&map);