From patchwork Tue Apr 15 14:42:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 3993481 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9FDBA9F2CC for ; Tue, 15 Apr 2014 14:42:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D893A20179 for ; Tue, 15 Apr 2014 14:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 103272015E for ; Tue, 15 Apr 2014 14:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754544AbaDOOmJ (ORCPT ); Tue, 15 Apr 2014 10:42:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57124 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754506AbaDOOmF (ORCPT ); Tue, 15 Apr 2014 10:42:05 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D69A9AD07; Tue, 15 Apr 2014 14:42:04 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 8A363DAA7C; Tue, 15 Apr 2014 16:42:04 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: clm@fb.com, David Sterba , Miao Xie , Wang Shilong Subject: [PATCH 2/2] btrfs: assert that send is not in progres before root deletion Date: Tue, 15 Apr 2014 16:42:03 +0200 Message-Id: X-Mailer: git-send-email 1.9.0 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CC: Miao Xie CC: Wang Shilong Signed-off-by: David Sterba --- fs/btrfs/ioctl.c | 1 + fs/btrfs/transaction.c | 13 ------------- 2 files changed, 1 insertions(+), 13 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a385d88bd8d5..3cdb62e7cab8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2352,6 +2352,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) { diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 34cd83184c4a..c2ae9bb1c308 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1977,19 +1977,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);