From: Johannes Thumshirn <jthumshirn@suse.de>
To: Hans van Kranenburg <Hans.van.Kranenburg@mendix.com>,
David Sterba <dsterba@suse.com>
Cc: Linux BTRFS Mailinglist <linux-btrfs@vger.kernel.org>,
Liu Bo <obuil.liubo@gmail.com>
Subject: Re: [PATCH] btrfs: ensure that a DUP block group has exactly two stripes
Date: Thu, 14 Feb 2019 17:21:54 +0100 [thread overview]
Message-ID: <01219372-4533-fb72-44fd-b2882c0614f6@suse.de> (raw)
In-Reply-To: <cbc103a1-3558-fac1-a45b-dcaf5d4d72ea@mendix.com>
On 13/02/2019 15:32, Hans van Kranenburg wrote:
[...]
>> +++ b/fs/btrfs/volumes.c
>> @@ -6794,7 +6794,7 @@ static int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info,
>> (type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes < 1) ||
>> (type & BTRFS_BLOCK_GROUP_RAID5 && num_stripes < 2) ||
>> (type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) ||
>> - (type & BTRFS_BLOCK_GROUP_DUP && num_stripes > 2) ||
>> + (type & BTRFS_BLOCK_GROUP_DUP && num_stripes != 2) ||
>> ((type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 &&
>> num_stripes != 1)) {
>> btrfs_err(fs_info,
>>
>
> It looks like the RAID1 check has a similar problem. Shouldn't that
> check also be != 2 ?
So looking at the code again I think num_stripes == 1 for RAID1 will
result in the same division by 0 in calc_stripe_length().
I'll send a patch for RAID1 as well unless David speaks up and says he
wants it amended in this one.
Thanks,
Johannes
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
next prev parent reply other threads:[~2019-02-14 16:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 14:26 [PATCH] btrfs: ensure that a DUP block group has exactly two stripes Johannes Thumshirn
2019-02-13 14:27 ` Nikolay Borisov
2019-02-13 14:32 ` Qu Wenruo
2019-02-13 14:32 ` Hans van Kranenburg
2019-02-13 14:37 ` Johannes Thumshirn
2019-02-13 15:02 ` Nikolay Borisov
2019-02-14 17:27 ` Hans van Kranenburg
2019-02-14 16:21 ` Johannes Thumshirn [this message]
2019-02-15 15:20 ` David Sterba
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=01219372-4533-fb72-44fd-b2882c0614f6@suse.de \
--to=jthumshirn@suse.de \
--cc=Hans.van.Kranenburg@mendix.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=obuil.liubo@gmail.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).