linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhilong Liu <zlliu@suse.com>
To: Jes.Sorensen@gmail.com
Cc: linux-raid@vger.kernel.org, Zhilong Liu <zlliu@suse.com>
Subject: [PATCH 1/3] mdadm/grow: Component size must be larger than chunk size
Date: Tue,  5 Sep 2017 17:41:36 +0800	[thread overview]
Message-ID: <1504604498-26048-2-git-send-email-zlliu@suse.com> (raw)
In-Reply-To: <1504604498-26048-1-git-send-email-zlliu@suse.com>

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>
---
 Grow.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Grow.c b/Grow.c
index 534ba80..f0a21ff 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);
-- 
2.6.6


  reply	other threads:[~2017-09-05  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05  9:41 [PATCH 0/3] mdadm patches for some trivial fixes Zhilong Liu
2017-09-05  9:41 ` Zhilong Liu [this message]
     [not found]   ` <20171005114430.GA24654@proton.igk.intel.com>
2017-10-07 12:17     ` [PATCH 1/3] mdadm/grow: Component size must be larger than chunk size Zhilong Liu
2017-10-07 12:31       ` Zhilong Liu
2017-10-09  3:32     ` Zhilong Liu
2017-10-09  7:17       ` Tomasz Majchrzak
2017-10-09 10:51       ` NeilBrown
2017-09-05  9:41 ` [PATCH 2/3] mdadm/manpage: disable bitmap_resize for external file bitmap Zhilong Liu
2017-09-05  9:41 ` [PATCH 3/3] mdadm: fixes some trivial typos in comments Zhilong Liu
2017-10-02 20:00 ` [PATCH 0/3] mdadm patches for some trivial fixes Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504604498-26048-2-git-send-email-zlliu@suse.com \
    --to=zlliu@suse.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).