Fix two mdadm bugs

1) Improve error message when trying to use --grow -n<X> on a Linear
   array
2) Allow assembly of explicitly specified arrays, even if they are
   disabled in /etc/mdadm.conf

Resolves: bz#1122146, bz#1124310

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2014-07-29 10:13:22 +02:00
parent 0e06f1f68a
commit 2439aace63
3 changed files with 135 additions and 1 deletions

View File

@ -0,0 +1,85 @@
From 5141638c54535b4ac80b8481404d868a63a18ecd Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 29 Jul 2014 13:48:23 +1000
Subject: [PATCH] Assemble: Only fail auto-assemble in face of mdadm.conf
conflicts.
We should never auto-assemble things that conflict with mdadm.conf
However explicit assembly requests should be allowed.
Reported-by: olovopb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1070245
Signed-off-by: NeilBrown <neilb@suse.de>
---
Assemble.c | 47 ++++++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index aca28be..cdcdb0f 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -366,9 +366,6 @@ static int select_devices(struct mddev_dev *devlist,
tmpdev = NULL;
goto loop;
} else {
- int rv = 0;
- struct mddev_ident *match;
-
content = *contentp;
tst->ss->getinfo_super(tst, content, NULL);
@@ -377,25 +374,33 @@ static int select_devices(struct mddev_dev *devlist,
report_mismatch ? devname : NULL))
goto loop;
- match = conf_match(tst, content, devname,
- report_mismatch ? c->verbose : -1,
- &rv);
- if (!match && rv == 2)
- goto loop;
- if (match && match->devname &&
- strcasecmp(match->devname, "<ignore>") == 0) {
- if (report_mismatch)
- pr_err("%s is a member of an explicitly ignored array\n",
- devname);
- goto loop;
- }
- if (match && !ident_matches(match, content, tst,
- c->homehost, c->update,
- report_mismatch ? devname : NULL))
- /* Array exists in mdadm.conf but some
- * details don't match, so reject it
+ if (auto_assem) {
+ /* Never auto-assemble things that conflict
+ * with mdadm.conf in some way
*/
- goto loop;
+ struct mddev_ident *match;
+ int rv = 0;
+
+ match = conf_match(tst, content, devname,
+ report_mismatch ? c->verbose : -1,
+ &rv);
+ if (!match && rv == 2)
+ goto loop;
+ if (match && match->devname &&
+ strcasecmp(match->devname, "<ignore>") == 0) {
+ if (report_mismatch)
+ pr_err("%s is a member of an explicitly ignored array\n",
+ devname);
+ goto loop;
+ }
+ if (match && !ident_matches(match, content, tst,
+ c->homehost, c->update,
+ report_mismatch ? devname : NULL))
+ /* Array exists in mdadm.conf but some
+ * details don't match, so reject it
+ */
+ goto loop;
+ }
/* should be safe to try an exclusive open now, we
* have rejected anything that some other mdadm might
--
1.9.3

View File

@ -0,0 +1,38 @@
From 46643e1ad5ece5f1257b2d827e36231df44929a2 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Tue, 29 Jul 2014 13:37:42 +1000
Subject: [PATCH] Grow: improve error message is "--grow -n2" used on Linear
arrays.
Linear arrays don't respond to setting raid-disks, only to
adding a device.
Reported-by: mulhern
Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1122146
Signed-off-by: NeilBrown <neilb@suse.de>
---
Grow.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index af59347..a9c8589 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1028,7 +1028,12 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
switch (info->array.level) {
default:
- return "Cannot understand this RAID level";
+ return "No reshape is possibly for this RAID level";
+ case LEVEL_LINEAR:
+ if (info->delta_disks != UnSet)
+ return "Only --add is supported for LINEAR, setting --raid-disks is not needed";
+ else
+ return "Only --add is supported for LINEAR, other --grow options are not meaningful";
case 1:
/* RAID1 can convert to RAID1 with different disks, or
* raid5 with 2 disks, or
--
1.9.3

View File

@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays) Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm Name: mdadm
Version: 3.3.1 Version: 3.3.1
Release: 2%{?dist} Release: 3%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init Source1: mdmonitor.init
Source2: raid-check Source2: raid-check
@ -11,6 +11,9 @@ Source5: mdadm-cron
Source6: mdmonitor.service Source6: mdmonitor.service
Source7: mdadm.conf Source7: mdadm.conf
Source8: mdadm_event.conf Source8: mdadm_event.conf
Patch1: mdadm-3.3.1-Grow-improve-error-message-is-grow-n2-used-on-Linear.patch
Patch2: mdadm-3.3.1-Assemble-Only-fail-auto-assemble-in-face-of-mdadm.co.patch
# Fedora customization patches # Fedora customization patches
Patch97: mdadm-3.3-udev.patch Patch97: mdadm-3.3-udev.patch
Patch98: mdadm-2.5.2-static.patch Patch98: mdadm-2.5.2-static.patch
@ -37,6 +40,8 @@ file can be used to help with some common tasks.
%prep %prep
%setup -q %setup -q
%patch1 -p1 -b .lineargrow
%patch2 -p1 -b .autofail
# Fedora customization patches # Fedora customization patches
%patch97 -p1 -b .udev %patch97 -p1 -b .udev
%patch98 -p1 -b .static %patch98 -p1 -b .static
@ -101,6 +106,12 @@ rm -rf %{buildroot}
/etc/libreport/events.d/* /etc/libreport/events.d/*
%changelog %changelog
* Tue Jul 29 2014 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.3.1-3
- Improve error message for "--grow -n2" when used on Linear arrays
- Fix problem where explicitly specified arrays were not assembled if
they were disabled in /etc/mdadm.conf
- Resolves bz1122146, bz1124310
* Thu Jun 12 2014 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.3.1-2 * Thu Jun 12 2014 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.3.1-2
- Revert 'change' event support fix from 3.3.1-1 - this requires a lot - Revert 'change' event support fix from 3.3.1-1 - this requires a lot
more testing if we are to go there. more testing if we are to go there.