Skip to content

Commit

Permalink
btrfs: hold a ref on the root in merge_reloc_roots
Browse files Browse the repository at this point in the history
We look up the corresponding root for the reloc root, we need to hold a
ref while we're messing with it.

Signed-off-by: Josef Bacik <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
josefbacik authored and kdave committed Mar 23, 2020
1 parent db2c2ca commit ab9737b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -2592,9 +2592,11 @@ void merge_reloc_roots(struct reloc_control *rc)
root = read_fs_root(fs_info,
reloc_root->root_key.offset);
BUG_ON(IS_ERR(root));
BUG_ON(!btrfs_grab_fs_root(root));
BUG_ON(root->reloc_root != reloc_root);

ret = merge_reloc_root(rc, root);
btrfs_put_fs_root(root);
if (ret) {
if (list_empty(&reloc_root->root_list))
list_add_tail(&reloc_root->root_list,
Expand Down

0 comments on commit ab9737b

Please sign in to comment.