btrfs: assert that send is not in progres before root deletion
authorDavid Sterba <dsterba@suse.cz>
Tue, 15 Apr 2014 14:42:03 +0000 (16:42 +0200)
committerChris Mason <clm@fb.com>
Tue, 10 Jun 2014 00:20:32 +0000 (17:20 -0700)
CC: Miao Xie <miaox@cn.fujitsu.com>
CC: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c
fs/btrfs/transaction.c

index 2db3fe1..ebac486 100644 (file)
@@ -2424,6 +2424,7 @@ out_unlock:
                shrink_dcache_sb(root->fs_info->sb);
                btrfs_invalidate_inodes(dest);
                d_delete(dentry);
+               ASSERT(dest->send_in_progress == 0);
 
                /* the last ref */
                if (dest->cache_inode) {
index 7579f6d..c30815e 100644 (file)
@@ -1984,19 +1984,6 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
        }
        root = list_first_entry(&fs_info->dead_roots,
                        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);
        spin_unlock(&fs_info->trans_lock);