From: NeilBrown Date: Tue, 10 Mar 2009 05:28:22 +0000 (+1100) Subject: Incremental: fix some handling of trustworthy. X-Git-Tag: mdadm-3.0-devel3~7 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=ecb02e31d5e29bda0d9d9c7ae073f8379c7558d5 Incremental: fix some handling of trustworthy. 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 --- diff --git a/Incremental.c b/Incremental.c index e293999e..f8a5d326 100644 --- a/Incremental.c +++ b/Incremental.c @@ -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);