From: NeilBrown <neilb@suse.com>
To: Zhilong Liu <zlliu@suse.com>,
Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
Jes Sorensen <jes.sorensen@gmail.com>
Subject: Re: [PATCH 1/3] mdadm/grow: Component size must be larger than chunk size
Date: Mon, 09 Oct 2017 21:51:49 +1100 [thread overview]
Message-ID: <87po9wy4oq.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <674a1606-c3cb-3043-165c-1ca5400a4626@suse.com>
[-- Attachment #1: Type: text/plain, Size: 2823 bytes --]
On Mon, Oct 09 2017, Zhilong Liu wrote:
> On 10/05/2017 07:44 PM, Tomasz Majchrzak wrote:
>> On Tue, Sep 05, 2017 at 05:41:36PM +0800, Zhilong Liu wrote:
>>> 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
>>
>> Hi Zhilong Liu,
>>
>> Above patch has broken RAID level conversion:
>>
>> Before the patch:
>>
>> mdadm --create /dev/md/raid --level=10 --raid-devices=4 /dev/nvme0n1
>> /dev/nvme1n1 /dev/nvme2n1 /dev/nvme3n1 --run --assume-clean
>> MDADM_EXPERIMENTAL=1 mdadm --grow /dev/md/raid --level=0
>> mdadm: level of /dev/md/raid changed to raid0
>>
>> After the patch:
>>
>> mdadm --create /dev/md/raid --level=10 --raid-devices=4 /dev/nvme0n1
>> /dev/nvme1n1 /dev/nvme2n1 /dev/nvme3n1 --run --assume-clean
>> MDADM_EXPERIMENTAL=1 mdadm --grow /dev/md/raid --level=0
>> mdadm: component size must be larger than chunk size.
>>
>> Could you take a look at it, please?
>
> Hi, Tomek;
> I just back from vacation, and this is very important info for me,
> thanks very much.
> Against this issue, the codes should be proper like:
>
> diff --git a/Grow.c b/Grow.c
> index 1149753..180fd78 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -1814,7 +1814,8 @@ int Grow_reshape(char *devname, int fd,
> }
>
> if (array.level > 1 &&
> - (array.chunk_size / 1024) > (int)s->size) {
> + (array.chunk_size / 1024) > (int)s->size &&
> + s->level == UnSet) {
> pr_err("component size must be larger than chunk size.\n");
> return 1;
> }
I think the correct fix for this bug is to add a test for "s->size > 0".
if "s->size == 0", no size change has been requested.
NeilBrown
>
> Is this changing good for you? Any ideas is very welcome.
>
> Thanks,
> -Zhilong
>
>> Thanks,
>>
>> Tomek
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-10-09 10:51 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 ` [PATCH 1/3] mdadm/grow: Component size must be larger than chunk size Zhilong Liu
[not found] ` <20171005114430.GA24654@proton.igk.intel.com>
2017-10-07 12:17 ` 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 [this message]
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=87po9wy4oq.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=jes.sorensen@gmail.com \
--cc=linux-raid@vger.kernel.org \
--cc=tomasz.majchrzak@intel.com \
--cc=zlliu@suse.com \
/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).