From: David Sterba <dsterba@suse.cz>
To: wqu@suse.com
Cc: Chung-Chiang Cheng <shepjeng@gmail.com>,
Chung-Chiang Cheng <cccheng@synology.com>,
clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@cccheng.net, Johnny Chang <johnnyc@synology.com>
Subject: Re: [PATCH] btrfs: refuse to remount read-write with unsupported compat-ro features
Date: Tue, 20 Dec 2022 20:53:06 +0100 [thread overview]
Message-ID: <20221220195306.GU10499@twin.jikos.cz> (raw)
In-Reply-To: <CAL3q7H5+aVYC-nQaX4_F=eRPpU8xRNEE73MHy-_fdoQFwNMDsA@mail.gmail.com>
On Tue, Dec 06, 2022 at 11:14:56AM +0000, Filipe Manana wrote:
> On Tue, Dec 6, 2022 at 2:42 AM Chung-Chiang Cheng <shepjeng@gmail.com> wrote:
> >
> > On Mon, Dec 5, 2022 at 6:45 PM Filipe Manana <fdmanana@kernel.org> wrote:
> > >
> > > Wasn't this already done by the following commit?
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=81d5d61454c365718655cfc87d8200c84e25d596
> > >
> > > Thanks.
> > >
> >
> > Wow. I did not notice this commit doing the same job by Qu. But I have
> > tested the latest linux-6.1 rc-7, and it's still able to mount a unsupported
> > comat-ro btrfs as read-write via remount.
> >
> > It's caused by the follow-up commit d7f67ac9a928 ("btrfs: relax
> > block-group-tree feature dependency checks"). This commit checks read-
> > only with the current superblock, which will always pass in the situation
> > remounting from read-only to read-write. It seems `btrfs_check_features()`
> > cannot cover this scenario.
> >
> > if (compat_ro_unsupp && !sb_rdonly(sb)) {
> > ^^^^^^^^^^^^^^
>
> Yep, that's a bug.
> btrfs_check_features() is called before the read only flag is updated
> in the super block.
>
> So the condition should be:
>
> if (compat_ro_unsupp && sb_rdonly(sb) && we_want_to_transition_to_rw)
>
> We need to pass the flags passed to btrfs_remount() to
> btrfs_check_features() for that "we_want_to_transition_to_rw" check.
>
> That seems to be what needs to be fixed.
Qu, can you please have a look, it's caused by commit
81d5d61454c365718655cfc87d8200c84e25d596 that's also in stable kernels
so this should be fixed quickly.
prev parent reply other threads:[~2022-12-20 19:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 16:07 Chung-Chiang Cheng
2022-12-05 10:44 ` Filipe Manana
2022-12-06 2:42 ` Chung-Chiang Cheng
2022-12-06 11:14 ` Filipe Manana
2022-12-20 19:53 ` David Sterba [this message]
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=20221220195306.GU10499@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=cccheng@synology.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=johnnyc@synology.com \
--cc=josef@toxicpanda.com \
--cc=kernel@cccheng.net \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shepjeng@gmail.com \
--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
all inboxes | Powered by JetHome®