summaryrefslogtreecommitdiffstats
path: root/policy.c
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@intel.com>2018-01-11 12:39:49 +0100
committerJes Sorensen <jsorensen@fb.com>2018-01-21 16:19:25 -0500
commit3bf9495270d7cd00da942e183dc5f7c7eb68ff69 (patch)
tree8824a4b538e65b56406b9ae5e9c1279970afaf0f /policy.c
parentab0c6bb9fca44d75438115602a1b128c11ce0fe8 (diff)
downloadmdadm-3bf9495270d7cd00da942e183dc5f7c7eb68ff69.tar.gz
policy.c: Avoid to take spare without defined domain by imsm
Only Imsm get_disk_controller_domain returns disk controller domain for each disk. It causes that mdadm automatically creates disk controller domain policy for imsm metadata, and imsm containers in the same disk controller domain can take spare for recovery. Ignore spares if only one imsm domain is matched. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'policy.c')
-rw-r--r--policy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/policy.c b/policy.c
index b17585a9..c0d18a7e 100644
--- a/policy.c
+++ b/policy.c
@@ -661,6 +661,7 @@ int domain_test(struct domainlist *dom, struct dev_policy *pol,
* 1: has domains, all match
*/
int found_any = -1;
+ int has_one_domain = 1;
struct dev_policy *p;
pol = pol_find(pol, pol_domain);
@@ -670,6 +671,9 @@ int domain_test(struct domainlist *dom, struct dev_policy *pol,
dom = dom->next;
if (!dom || strcmp(dom->dom, p->value) != 0)
return 0;
+ if (has_one_domain && metadata && strcmp(metadata, "imsm") == 0)
+ found_any = -1;
+ has_one_domain = 0;
}
return found_any;
}