Fix two IMSM bugs

- Disallow creating a second IMSM RAID array size 0 (bz880972)
- Disallow creating IMSM RAIDs that spans multiple controllers (bz880974)

Resolves bz880972, bz880974

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2012-11-30 17:52:41 +01:00
parent d631eadf39
commit bbba7e024c
3 changed files with 114 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 066e92f017df22c879c455494d2c1743ef7f3aca Mon Sep 17 00:00:00 2001
From: Lukasz Dorau <lukasz.dorau@intel.com>
Date: Fri, 16 Nov 2012 17:24:36 +0100
Subject: [PATCH] Create.c: check if freesize is equal 0
"freesize" can be equal 0, particularly after rounding to the chunk's size.
Creating should be aborted in such case.
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
Create.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Create.c b/Create.c
index afcf1a5..436bd1d 100644
--- a/Create.c
+++ b/Create.c
@@ -407,6 +407,11 @@
do_default_chunk = 0;
}
}
+ if (!freesize) {
+ fprintf(stderr, Name "no free space left on %s\n", dname);
+ fail = 1;
+ continue;
+ }
if (size && freesize < size) {
fprintf(stderr, Name ": %s is smaller than given size."

View File

@ -0,0 +1,73 @@
From 3c309c82699ae3bebc716dbd5abea079dd41184a Mon Sep 17 00:00:00 2001
From: Marcin Tomczak <marcin.tomczak@intel.com>
Date: Fri, 9 Nov 2012 15:46:36 +0100
Subject: [PATCH] imsm: Forbid spanning between multiple controllers.
Attaching disks to multiple controllers of the same type has been
allowed so far. Now spanning between multiple controllers is disallowed
at all by IMSM metadata.
Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com>
Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
super-intel.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 202b83f..4ac9d42 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -558,20 +558,11 @@ static int attach_hba_to_super(struct intel_super *super, struct sys_dev *device
if (super->hba == NULL) {
super->hba = alloc_intel_hba(device);
return 1;
- }
-
- hba = super->hba;
- /* Intel metadata allows for all disks attached to the same type HBA.
- * Do not sypport odf HBA types mixing
- */
- if (device->type != hba->type)
+ } else
+ /* IMSM metadata disallows to attach disks to multiple
+ * controllers.
+ */
return 2;
-
- while (hba->next)
- hba = hba->next;
-
- hba->next = alloc_intel_hba(device);
- return 1;
}
static struct sys_dev* find_disk_attached_hba(int fd, const char *devname)
@@ -3073,11 +3064,11 @@ static int compare_super_imsm(struct supertype *st, struct supertype *tst)
*/
if (!check_env("IMSM_NO_PLATFORM")) {
- if (!first->hba || !sec->hba ||
- (first->hba->type != sec->hba->type)) {
+ if (first->hba && sec->hba &&
+ strcmp(first->hba->path, sec->hba->path) != 0) {
fprintf(stderr,
"HBAs of devices does not match %s != %s\n",
- first->hba ? get_sys_dev_type(first->hba->type) : NULL,
- sec->hba ? get_sys_dev_type(sec->hba->type) : NULL);
+ first->hba ? first->hba->path : NULL,
+ sec->hba ? sec->hba->path : NULL);
return 3;
}
}
@@ -3819,7 +3810,7 @@ static int find_intel_hba_capability(int fd, struct intel_super *super, char *de
}
fprintf(stderr, ").\n"
- " Mixing devices attached to different controllers "
+ " Mixing devices attached to multiple controllers "
"is not allowed.\n");
}
free_sys_dev(&hba_name);
--
1.7.11.7

View File

@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 3.2.6
Release: 2%{?dist}
Release: 3%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
@ -13,6 +13,8 @@ Source7: mdmonitor-takeover.service
Source8: mdadm.conf
Source9: mdadm_event.conf
Patch0: mdadm-3.2.6-cgroup.patch
Patch1: mdadm-3.2.6-Create.c-check-if-freesize-is-equal-0.patch
Patch2: mdadm-3.2.6-imsm-Forbid-spanning-between-multiple-controllers.patch
# Fedora customization patches
Patch97: mdadm-3.2.6-udev.patch
Patch98: mdadm-2.5.2-static.patch
@ -60,6 +62,9 @@ is not used as the system init process.
%patch0 -p1 -b .cgroup
%endif
%patch1 -p1 -b .raidsize
%patch2 -p1 -b .multictrl
# Fedora customization patches
%patch97 -p1 -b .udev
%patch98 -p1 -b .static
@ -140,6 +145,11 @@ rm -rf %{buildroot}
%{_initrddir}/*
%changelog
* Fri Nov 30 2012 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.2.6-3
- Disallow creating a second IMSM RAID array size 0 (bz880972)
- Disallow creating IMSM RAIDs that spans multiple controllers (bz880974)
- Resolves bz880972, bz880974
* Thu Nov 15 2012 Doug Ledford <dledford@redhat.com> - 3.2.6-2
- Modify mdadm to set the cgroup of mdmon to systemd if it's available
- Related bz873576 (and others)