Skip to contentSkip to conversation

policy.c: Avoid to take spare without defined domain by imsm

PATCH Applied Mariusz Tkaczyk 2 participants 2 messages Jan 11, 2018 – Jan 21, 2018 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 policy.c | 4 ++++
 1 file changed, 4 insertions(+)
policy.c +4 -0
index b17585a..4f1ca8b 100644
@@ -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;
 }
Signature · 1 line
1.8.3.1
Applied
#1 lore raw
Quoted 11 lines · Mariusz Tkaczyk

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.

---
 policy.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied!

Thanks,
Jes