Skip to content

Commit c22750c

Browse files
boryaskdave
authored andcommitted
btrfs: always clear PERTRANS metadata during commit
It is possible to clear a root's IN_TRANS tag from the radix tree, but not clear its PERTRANS, if there is some error in between. Eliminate that possibility by moving the free up to where we clear the tag. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Boris Burkov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 8a9fbee commit c22750c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/transaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
14941494
radix_tree_tag_clear(&fs_info->fs_roots_radix,
14951495
(unsigned long)root->root_key.objectid,
14961496
BTRFS_ROOT_TRANS_TAG);
1497+
btrfs_qgroup_free_meta_all_pertrans(root);
14971498
spin_unlock(&fs_info->fs_roots_radix_lock);
14981499

14991500
btrfs_free_log(trans, root);
@@ -1518,7 +1519,6 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
15181519
if (ret2)
15191520
return ret2;
15201521
spin_lock(&fs_info->fs_roots_radix_lock);
1521-
btrfs_qgroup_free_meta_all_pertrans(root);
15221522
}
15231523
}
15241524
spin_unlock(&fs_info->fs_roots_radix_lock);

0 commit comments

Comments
 (0)