Commit 61155aa0 authored by David Sterba's avatar David Sterba Committed by Chris Mason

btrfs: assert that send is not in progres before root deletion

CC: Miao Xie <miaox@cn.fujitsu.com>
CC: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 521e0546
...@@ -2424,6 +2424,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -2424,6 +2424,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
shrink_dcache_sb(root->fs_info->sb); shrink_dcache_sb(root->fs_info->sb);
btrfs_invalidate_inodes(dest); btrfs_invalidate_inodes(dest);
d_delete(dentry); d_delete(dentry);
ASSERT(dest->send_in_progress == 0);
/* the last ref */ /* the last ref */
if (dest->cache_inode) { if (dest->cache_inode) {
......
...@@ -1984,19 +1984,6 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root) ...@@ -1984,19 +1984,6 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
} }
root = list_first_entry(&fs_info->dead_roots, root = list_first_entry(&fs_info->dead_roots,
struct btrfs_root, root_list); struct btrfs_root, root_list);
/*
* Make sure root is not involved in send,
* if we fail with first root, we return
* directly rather than continue.
*/
spin_lock(&root->root_item_lock);
if (root->send_in_progress) {
spin_unlock(&fs_info->trans_lock);
spin_unlock(&root->root_item_lock);
return 0;
}
spin_unlock(&root->root_item_lock);
list_del_init(&root->root_list); list_del_init(&root->root_list);
spin_unlock(&fs_info->trans_lock); spin_unlock(&fs_info->trans_lock);
......
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