]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/btrfs/ioctl.c
btrfs: don't abort filesystem when attempting to snapshot deleted subvolume
[thirdparty/linux.git] / fs / btrfs / ioctl.c
index 4e50b62db2a8feba629ee2ceb2040e28b4c2485b..fea5d37528b808c73c85fbb34a2e43be6555e714 100644 (file)
@@ -790,6 +790,9 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
                return -EOPNOTSUPP;
        }
 
+       if (btrfs_root_refs(&root->root_item) == 0)
+               return -ENOENT;
+
        if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
                return -EINVAL;