]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: clear dirty status from extent buffer on error at insert_new_root()
authorFilipe Manana <fdmanana@suse.com>
Mon, 30 Jun 2025 09:50:46 +0000 (10:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Aug 2025 16:30:53 +0000 (18:30 +0200)
commit16c5f89071045c96b51e9e64e5fabf847ea23fb6
tree563a91d5268503ba826a1ffcbbb26fcff274cead
parentd115fc9e96c36d8c0f1cd49a69e33af49a64d9ca
btrfs: clear dirty status from extent buffer on error at insert_new_root()

commit c0d013495a80cbb53e2288af7ae0ec4170aafd7c upstream.

If we failed to insert the tree mod log operation, we are not removing the
dirty status from the allocated and dirtied extent buffer before we free
it. Removing the dirty status is needed for several reasons such as to
adjust the fs_info->dirty_metadata_bytes counter and remove the dirty
status from the respective folios. So add the missing call to
btrfs_clear_buffer_dirty().

Fixes: f61aa7ba08ab ("btrfs: do not BUG_ON() on tree mod log failure at insert_new_root()")
CC: stable@vger.kernel.org # 6.6+
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ctree.c