public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>, Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: prevent remounting to v1 space cache for subpage mount
Date: Tue, 17 May 2022 08:27:19 +0800	[thread overview]
Message-ID: <6f64a575-2dec-78e8-51a6-009ea99a27d4@gmx.com> (raw)
In-Reply-To: <YoJoIeDHKTOKljfv@localhost.localdomain>



On 2022/5/16 23:05, Josef Bacik wrote:
> On Mon, May 16, 2022 at 02:26:53PM +0800, Qu Wenruo wrote:
>> Upstream commit 9f73f1aef98b ("btrfs: force v2 space cache usage for
>> subpage mount") forces subpage mount to use v2 cache, to avoid
>> deprecated v1 cache which doesn't support subpage properly.
>>
>> But there is a loophole that user can still remount to v1 cache.
>>
>> The existing check will only give users a warning, but not really
>> prevents the users to do the remount.
>>
>> Although remounting to v1 will not cause any problems since the v1 cache
>> will always be marked invalid when mounted with a different page size,
>> it's still better to prevent v1 cache at all for subpage mounts.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>>   fs/btrfs/super.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
>> index b1fdc6a26c76..1617528a3367 100644
>> --- a/fs/btrfs/super.c
>> +++ b/fs/btrfs/super.c
>> @@ -1985,6 +1985,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
>>   	if (ret)
>>   		goto restore;
>>
>> +	/* V1 cache is not supported for subpage mount. */
>> +	if (fs_info->sectorsize < PAGE_SIZE &&
>> +	    btrfs_test_opt(fs_info, SPACE_CACHE)) {
>> +		btrfs_warn(fs_info,
>> +	"v1 space cache is not supported for page size %lu with sectorsize %u",
>> +			   PAGE_SIZE, fs_info->sectorsize);
>
> Shouldn't we be doing ret = -EINVAL; here?  Thanks,
>
> Josef

Oh, forgot that.

Thanks for catching it,
Qu

  reply	other threads:[~2022-05-17  0:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16  6:26 [PATCH] btrfs: prevent remounting to v1 space cache for subpage mount Qu Wenruo
2022-05-16 15:05 ` Josef Bacik
2022-05-17  0:27   ` Qu Wenruo [this message]
2022-05-18  4:58 ` [kbuild] " Dan Carpenter

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=6f64a575-2dec-78e8-51a6-009ea99a27d4@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=josef@toxicpanda.com \
    --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