diff --git a/0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch b/0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch new file mode 100644 index 0000000..f40b7aa --- /dev/null +++ b/0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch @@ -0,0 +1,47 @@ +From 3bf9495270d7cd00da942e183dc5f7c7eb68ff69 Mon Sep 17 00:00:00 2001 +From: Mariusz Tkaczyk +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 +Signed-off-by: Jes Sorensen +Signed-off-by: Coly Li +--- + 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 + diff --git a/mdadm.changes b/mdadm.changes index 4f5e625..9937255 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sat Feb 10 14:34:01 UTC 2018 - colyli@suse.com + +- policy.c: Avoid to take spare without defined domain by imsm + (bsc#1076588) + 0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch + ------------------------------------------------------------------- Tue Jan 9 03:30:48 UTC 2018 - zlliu@suse.com diff --git a/mdadm.spec b/mdadm.spec index 041c4ad..37bfbd9 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -251,6 +251,7 @@ Patch205: 0205-Monitor-msg-Don-t-print-error-message-if-mdmon-doesn.patch Patch206: 0206-imsm-continue-resync-on-3-disk-RAID10.patch Patch207: 0207-managemon-Don-t-add-disk-to-the-array-after-it-has-s.patch Patch208: 0208-mdadm-grow-correct-the-s-size-1-to-make-max-work.patch +Patch209: 0209-policy.c-Avoid-to-take-spare-without-defined-domain-.patch %define _udevdir %(pkg-config --variable=udevdir udev) %define _systemdshutdowndir %{_unitdir}/../system-shutdown @@ -469,6 +470,7 @@ programs but with a very different interface. %patch206 -p1 %patch207 -p1 %patch208 -p1 +%patch209 -p1 %build make %{?_smp_mflags} CC="%__cc" CXFLAGS="$RPM_OPT_FLAGS -Wno-error" SUSE=yes