summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorZhilong Liu <zlliu@suse.com>2017-09-05 11:41:36 +0200
committerJes Sorensen <jsorensen@fb.com>2017-10-02 21:59:24 +0200
commit4b74a905a67e0587ffa6f75d76eb8112e6aa8eed (patch)
treeedfd749be116892e9e54d174ac010b8a7eff8b60 /Grow.c
parentMonitor: Check redundancy for arrays (diff)
downloadmdadm-4b74a905a67e0587ffa6f75d76eb8112e6aa8eed.tar.xz
mdadm-4b74a905a67e0587ffa6f75d76eb8112e6aa8eed.zip
mdadm/grow: Component size must be larger than chunk size
Grow: Changing component size must be larger than current chunk size against stripe raids, otherwise Grow_reshape() would set s->size to '0'. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Grow.c b/Grow.c
index 267b06f7..bab1eec1 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1816,6 +1816,12 @@ int Grow_reshape(char *devname, int fd,
return 1;
}
+ if (array.level > 1 &&
+ (array.chunk_size / 1024) > (int)s->size) {
+ pr_err("component size must be larger than chunk size.\n");
+ return 1;
+ }
+
st = super_by_fd(fd, &subarray);
if (!st) {
pr_err("Unable to determine metadata format for %s\n", devname);