Skip to content

Commit ac7fa34

Browse files
fdmananaopsiff
authored andcommitted
btrfs: clear dirty status from extent buffer on error at insert_new_root()
commit c0d0134 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: f61aa7b ("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> (cherry picked from commit 16c5f89071045c96b51e9e64e5fabf847ea23fb6)
1 parent a0ab462 commit ac7fa34

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/btrfs/ctree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,6 +2901,7 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,
29012901
if (ret < 0) {
29022902
int ret2;
29032903

2904+
btrfs_clear_buffer_dirty(trans, c);
29042905
ret2 = btrfs_free_tree_block(trans, btrfs_root_id(root), c, 0, 1);
29052906
if (ret2 < 0)
29062907
btrfs_abort_transaction(trans, ret2);

0 commit comments

Comments
 (0)