public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, HAN Yuwei <hrx@bupt.moe>,
	stable@vger.kernel.org
Subject: Re: [PATCH] btrfs: reject zoned RW mount if sectorsize is smaller than page size
Date: Tue, 13 Feb 2024 09:24:12 +1030	[thread overview]
Message-ID: <e30938f6-824e-43df-b3ee-425b794a59ca@suse.com> (raw)
In-Reply-To: <20240212111450.GZ355@twin.jikos.cz>


[-- Attachment #1.1.1: Type: text/plain, Size: 2379 bytes --]



On 2024/2/12 21:44, David Sterba wrote:
> On Mon, Feb 12, 2024 at 03:46:15PM +1030, Qu Wenruo wrote:
>> [BUG]
>> There is a bug report that with zoned device and sectorsize is smaller
>> than page size (aka, subpage), btrfs would crash with a very basic
>> workload:
>>
>>   # getconfig PAGESIZE
>>   16384
>>   # mkfs.btrfs -f $dev -s 4k
>>   # mount $dev $mnt
>>   # $fsstress -w -n 8 -s 1707820327 -v -d $mnt
>>   # umount $mnt
>>
>> The crash would look like this (with CONFIG_BTRFS_ASSERT enabled):
>>
>>   assertion failed: block_start != EXTENT_MAP_HOLE, in fs/btrfs/extent_io.c:1384
> 
> This is the same as what Josef fixed in
> https://github.com/btrfs/linux/commit/400bb013912dac637c7d6826407be580ea8ef9cc
> "btrfs: don't drop extent_map for free space inode on write error"
> but not on zoned+subpage, is it really a different error you're fixing?

Yes, it's really a different bug.

Although the root cause is a little more complex, it has to be explained 
through the whole CAUSE section.

> 
> [...]
>> [WORKAROUND]
>> A proper fix requires some big changes to delalloc workload, to allow
>> extent_write_locked_range() to handle multiple different entries with
>> the same @locked_page.
>>
>> So for now, disable read-write support for subpage zoned btrfs.
>>
>> The problem can only be solved if subpage btrfs can handle subpage
>> compression, which need quite some work on the delalloc procedure for
>> the @locked_page handling.
> 
> Ok, this on itself is a valid reason to disable the support.

But this reminds me that, I have to work on the proper delalloc support 
for subpage.

My current plan is:

1. Introduce subpage LOCK bitmap
    Not just only an atomic counter.

2. Make find_lock_delalloc_range() to populate that lock bitmap

3. Make find_lock_delalloc_range() to find all delalloc range of
    a page and properly lock them
    This would not change the behavior for page sized sectorsize.

4. Make find_lock_delalloc_range() to skip the page if it's already
    being locked before.
    This is also a subpage specific behavior

With above planned work, btrfs should be able to handle subpage unlock, 
so that we won't need weird @locked_page handling.

Hopefully this would solve both the subpage+zoned and full sector 
aligned subpage compression support.

Thanks,
Qu

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7027 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2024-02-12 22:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  5:16 [PATCH] btrfs: reject zoned RW mount if sectorsize is smaller than page size Qu Wenruo
2024-02-12  9:45 ` Johannes Thumshirn
2024-02-12  9:50   ` Qu Wenruo
2024-02-12 10:25     ` Johannes Thumshirn
2024-02-14  7:29     ` David Sterba
2024-02-17  0:07       ` Qu Wenruo
2024-02-12 11:14 ` David Sterba
2024-02-12 22:54   ` Qu Wenruo [this message]
2024-02-14  7:28 ` 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=e30938f6-824e-43df-b3ee-425b794a59ca@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.cz \
    --cc=hrx@bupt.moe \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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