Accepting request 575332 from 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 (forwarded request 575225 from colyli)

OBS-URL: https://build.opensuse.org/request/show/575332
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mdadm?expand=0&rev=114
This commit is contained in:
2018-02-12 09:25:04 +00:00
committed by Git OBS Bridge
3 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
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

View File

@@ -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

View File

@@ -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