]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: don't unconditionally call folio_start_writeback in subpage
authorJosef Bacik <josef@toxicpanda.com>
Wed, 10 Jan 2024 22:14:21 +0000 (17:14 -0500)
committerDavid Sterba <dsterba@suse.com>
Thu, 18 Jan 2024 22:39:59 +0000 (23:39 +0100)
commit1e61b8c672ab2f59b282c8d48a29c14b52c0f5b4
tree0d9436aa2a21831429506579262eec5c62eec212
parent2018ef1d9ac3e95448b9206adc3425b0431c2411
btrfs: don't unconditionally call folio_start_writeback in subpage

In the normal case we check if a page is under writeback and skip it
before we attempt to begin writeback.

The exception is subpage metadata writes, where we know we don't have an
eb under writeback and we're doing it one eb at a time.  Since
b5612c368648 ("mm: return void from folio_start_writeback() and related
functions") we now will BUG_ON() if we call folio_start_writeback()
on a folio that's already under writeback.  Previously
folio_start_writeback() would bail if writeback was already started.

Fix this in the subpage code by checking if we have writeback set and
skipping it if we do.  This fixes the panic we were seeing on subpage.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/subpage.c