From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Anand Jain <anand.jain@oracle.com>,
dsterba@suse.cz, Qu Wenruo <wqu@suse.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs: Add incompat flags check for btrfs_check_super_valid()
Date: Sat, 21 Apr 2018 10:43:59 +0800 [thread overview]
Message-ID: <999a862f-a50b-9d21-94de-53463b6f3387@gmx.com> (raw)
In-Reply-To: <a5e4bc54-460e-7db7-ebaa-98e1d9aaee5e@oracle.com>
[-- Attachment #1.1: Type: text/plain, Size: 4083 bytes --]
On 2018年04月21日 10:38, Anand Jain wrote:
>
>
> On 04/20/2018 11:15 PM, David Sterba wrote:
>> On Fri, Apr 20, 2018 at 10:32:03PM +0800, Anand Jain wrote:
>>>
>>>
>>> On 04/19/2018 05:38 PM, Qu Wenruo wrote:
>>>> Although we have already checked incompat flags manually before really
>>>> mounting it, we could still enhance btrfs_check_super_valid() to check
>>>> incompat flags for later write time super block validation check.
>>>>
>>>> This patch adds such incompat flags check for
>>>> btrfs_check_super_valid(),
>>>> currently it won't be triggered, but provides the basis for later write
>>>> time check.
>>>>
>>>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>>>> ---
>>>> fs/btrfs/disk-io.c | 13 +++++++++++++
>>>> 1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
>>>> index 60caa68c3618..ec123158f051 100644
>>>> --- a/fs/btrfs/disk-io.c
>>>> +++ b/fs/btrfs/disk-io.c
>>>> @@ -4104,6 +4104,19 @@ static int btrfs_check_super_valid(struct
>>>> btrfs_fs_info *fs_info)
>>>> ret = -EINVAL;
>>>> }
>>>> + /*
>>>> + * Before calling btrfs_check_super_valid() we have already
>>>> checked
>>>> + * incompat flags. So if we developr new incompat flags, it's
>>>> must be
>>>> + * some corruption.
>>>> + */
>>>> + if (btrfs_super_incompat_flags(sb) &
>>>> ~BTRFS_FEATURE_INCOMPAT_SUPP) {
>>>> + btrfs_err(fs_info,
>>>> + "corrupted incompat flags detected 0x%llx, supported 0x%llx",
>>
>>> 2707 features = btrfs_super_incompat_flags(disk_super) &
>>> 2708 ~BTRFS_FEATURE_INCOMPAT_SUPP;
>>> 2709 if (features) {
>>> 2710 btrfs_err(fs_info,
>>> 2711 "cannot mount because of unsupported
>>> optional features (%llx)",
>>> 2712 features);
>>> 2713 err = -EINVAL;
>>> 2714 goto fail_alloc;
>>> 2715 }
>>
>> So there's a "user experience" change, now that you pointed out the
>> other check.
>
> Its a regression.
>
>> If a filesystem with incompat bits set will be mounted,
>> this will say 'you have corrupted filesystem', which is not IMO what we
>> want to tell.
>>
>> Tough the extended btrfs_check_super_valid could catch the corrupted
>> incompat bits, what we need at mount time is wording from the 2nd
>> message ("cannot mount unsuppported features").
>>
>> I think that there should be a separate function that does the
>> pre-commit checks, calls btrfs_check_super_valid and also validates the
>> incompat bit.
>
> We can still print it as 'unsupported optional features', which would
> imply corruption in the non-mount context.
In that case such wording is not obvious enough to info it's super block
corruption.
So I still prefer current way of checking incompact flags and csum types
manually at mount time before btrfs_validate_super().
David's idea of a separate function to do mount time check and gives
better prompt is pretty good.
Especially for incompat features, as incompat features will increase in
the future and for older kernel info such feature as corruption is not
acceptable.
But currently, there are only 2 members we need to check at mount time
(csum_type and incompat features), and only one caller, current code
looks good enough for its purpose.
Thanks,
Qu
>
> Thanks, Anand
>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-04-21 2:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 9:38 [PATCH 1/3] btrfs: Add incompat flags check for btrfs_check_super_valid() Qu Wenruo
2018-04-19 9:38 ` [PATCH 2/3] btrfs: Add csum type " Qu Wenruo
2018-04-19 10:09 ` David Sterba
2018-04-19 10:24 ` Qu Wenruo
2018-04-19 9:38 ` [PATCH 3/3] btrfs: Do super block verification before writing it to disk Qu Wenruo
2018-04-19 10:16 ` David Sterba
2018-04-19 10:32 ` Qu Wenruo
2018-04-20 14:46 ` Anand Jain
2018-04-19 10:59 ` [PATCH 1/3] btrfs: Add incompat flags check for btrfs_check_super_valid() Nikolay Borisov
2018-04-19 11:10 ` Qu Wenruo
2018-04-19 15:31 ` David Sterba
2018-04-19 16:24 ` Nikolay Borisov
2018-04-20 13:04 ` David Sterba
2018-04-20 14:32 ` Anand Jain
2018-04-20 15:15 ` David Sterba
2018-04-21 2:38 ` Anand Jain
2018-04-21 2:43 ` Qu Wenruo [this message]
2018-04-21 5:18 ` Anand Jain
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=999a862f-a50b-9d21-94de-53463b6f3387@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=anand.jain@oracle.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@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