SHA256
1
0
forked from pool/mdadm
mdadm/0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch
Neil Brown 91d5cd723f Accepting request 575225 from home:colyli:branches:Base:System
- policy.c: Avoid to take spare without defined domain by imsm
  (bsc#1076588)
  0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch

OBS-URL: https://build.opensuse.org/request/show/575225
OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=162
2018-02-11 03:48:32 +00:00

48 lines
1.5 KiB
Diff

From 3bf9495270d7cd00da942e183dc5f7c7eb68ff69 Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Date: Thu, 11 Jan 2018 12:39:49 +0100
Subject: [PATCH] policy.c: Avoid to take spare without defined domain by imsm
Git-commit: 3bf9495270d7cd00da942e183dc5f7c7eb68ff69
Patch-mainline: mdadm-4.0+
References: bsc#1076588
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>
Signed-off-by: Coly Li <colyli@suse.de>
---
policy.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/policy.c b/policy.c
index b17585a..c0d18a7 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;
}
--
2.16.1