diff options
author | Josef Bacik <josef@toxicpanda.com> | 2020-01-24 09:32:52 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-02-10 14:40:33 +0100 |
commit | c15e9d94d33a382389c000c4b9f0869d3b2e8ac9 (patch) | |
tree | 02fedad1d064e48846d19710df0389fa74b594c7 | |
parent | 060027bf6fc5ced196224c9c6448f5090c33f2bf (diff) | |
download | btrfs-next-c15e9d94d33a382389c000c4b9f0869d3b2e8ac9.tar.gz |
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: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/volumes.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0b3167bd9f35cc..3fca9f9e3b5d86 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -4431,6 +4431,10 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info, ret = 1; goto out; } + if (!btrfs_grab_fs_root(subvol_root)) { + ret = 1; + goto out; + } switch (type) { case BTRFS_UUID_KEY_SUBVOL: @@ -4443,7 +4447,7 @@ static int btrfs_check_uuid_tree_entry(struct btrfs_fs_info *fs_info, ret = 1; break; } - + btrfs_put_fs_root(subvol_root); out: return ret; } |