Commit fbb0ce40 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: hold a ref on the root in btrfs_check_uuid_tree_entry

We lookup the uuid of arbitrary subvolumes, hold a ref on the root while
we're doing this.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ca2037fb
...@@ -4431,6 +4431,10 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info, ...@@ -4431,6 +4431,10 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
ret = 1; ret = 1;
goto out; goto out;
} }
if (!btrfs_grab_fs_root(subvol_root)) {
ret = 1;
goto out;
}
switch (type) { switch (type) {
case BTRFS_UUID_KEY_SUBVOL: case BTRFS_UUID_KEY_SUBVOL:
...@@ -4443,7 +4447,7 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info, ...@@ -4443,7 +4447,7 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info,
ret = 1; ret = 1;
break; break;
} }
btrfs_put_fs_root(subvol_root);
out: out:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment