diff options
author | Mariusz Dabrowski <mariusz.dabrowski@intel.com> | 2016-10-12 14:29:42 +0200 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@redhat.com> | 2016-10-19 17:26:49 +0200 |
commit | ddab63c7debe8f5bf955ae5202abe5553736a1e1 (patch) | |
tree | c97f109b2b8c464146d521907517d149b40e5c0a /Grow.c | |
parent | imsm: block chunk size change for RAID 10 (diff) | |
download | mdadm-ddab63c7debe8f5bf955ae5202abe5553736a1e1.tar.xz mdadm-ddab63c7debe8f5bf955ae5202abe5553736a1e1.zip |
Allow level migration only for single-array container
IMSM doesn't allow to change RAID level of array in container with two
arrays but array count check is being done too late (after removing disks)
and in some cases (e. g. RAID 0 and RAID 1 migrated to RAID 0) both arrays
become degraded. This patch adds array count check before disks are being
removed.
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'Grow.c')
-rwxr-xr-x | Grow.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -777,6 +777,26 @@ int remove_disks_for_takeover(struct supertype *st, struct mdinfo *remaining; int slot; + if (st->ss->external) { + int rv = 0; + struct mdinfo *arrays = st->ss->container_content(st, NULL); + /* + * containter_content returns list of arrays in container + * If arrays->next is not NULL it means that there are + * 2 arrays in container and operation should be blocked + */ + if (arrays) { + if (arrays->next) + rv = 1; + sysfs_free(arrays); + if (rv) { + pr_err("Error. Cannot perform operation on /dev/%s\n", st->devnm); + pr_err("For this operation it MUST be single array in container\n"); + return rv; + } + } + } + if (sra->array.level == 10) nr_of_copies = layout & 0xff; else if (sra->array.level == 1) |