]> git.hungrycats.org Git - linux/commitdiff
btrfs: hold a ref on the root in btrfs_check_uuid_tree_entry
authorJosef Bacik <josef@toxicpanda.com>
Wed, 20 Nov 2019 20:36:19 +0000 (12:36 -0800)
committerJosef Bacik <josef@toxicpanda.com>
Fri, 6 Dec 2019 16:34:48 +0000 (08:34 -0800)
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>
fs/btrfs/volumes.c

index 904c3e03467ffb71b2860fe844a7d7fea4da6ed3..47ac3277ee08cee7f038956327f7a7416913d130 100644 (file)
@@ -4379,6 +4379,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:
@@ -4391,7 +4395,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;
 }