diff options
author | NeilBrown <neilb@suse.de> | 2011-02-01 04:44:02 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-02-01 04:44:02 +0100 |
commit | a5d10dcec81b46f68d18408dcdced4235df99c55 (patch) | |
tree | 6ce53313cb8e24a0434dc579c21867feab3501d1 /Assemble.c | |
parent | Allow domain_test to report that no domains were found. (diff) | |
download | mdadm-a5d10dcec81b46f68d18408dcdced4235df99c55.tar.xz mdadm-a5d10dcec81b46f68d18408dcdced4235df99c55.zip |
Allow explicitly listed spared to be included by default.
When the metadata doesn't identify which array a spare belongs to
we normally require an explicit domain match to connect a spare
with an array.
However when the spare is explicitly listed in argv, it should be
safe to include as long as there is no domain conflict.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Assemble.c')
-rw-r--r-- | Assemble.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -595,10 +595,15 @@ int Assemble(struct supertype *st, char *mddev, tmpdev->devname, strerror(errno)); tmpdev->used = 2; } else { - struct dev_policy *pol = NULL; - pol = devnum_policy(stb.st_rdev); - if (domain_test(domains, pol, NULL) == 1) - /* take this spare if domains match */ + struct dev_policy *pol = devnum_policy(stb.st_rdev); + int dt = domain_test(domains, pol, NULL); + if (inargv && dt != 0) + /* take this spare as domains match + * if there are any */ + tmpdev->used = 1; + else if (!inargv && dt == 1) + /* device wasn't explicitly listed, so need + * explicit domain match - which we have */ tmpdev->used = 1; else /* if domains don't match mark as unused */ |