From patchwork Fri Feb 6 05:45:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 5788661 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DAE74BF440 for ; Fri, 6 Feb 2015 05:47:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 181D820166 for ; Fri, 6 Feb 2015 05:47:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4216520165 for ; Fri, 6 Feb 2015 05:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255AbbBFFrr (ORCPT ); Fri, 6 Feb 2015 00:47:47 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:57905 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751075AbbBFFro (ORCPT ); Fri, 6 Feb 2015 00:47:44 -0500 X-IronPort-AV: E=Sophos;i="5.04,848,1406563200"; d="scan'208";a="57209718" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 06 Feb 2015 13:44:11 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t165kxvS016592 for ; Fri, 6 Feb 2015 13:46:59 +0800 Received: from localhost.localdomain (10.167.226.33) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 6 Feb 2015 13:47:43 +0800 From: Qu Wenruo To: Subject: [PATCH v7 7/9] btrfs: Move btrfs_sysfs_remove_one(fs_info) before transcation thread cleanup. Date: Fri, 6 Feb 2015 13:45:32 +0800 Message-ID: <1423201534-19309-8-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1423201534-19309-1-git-send-email-quwenruo@cn.fujitsu.com> References: <1423201534-19309-1-git-send-email-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.33] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Since btrfs sysfs interfaces can start new transaction, we need to do it before transaction thread cleanup. Signed-off-by: Qu Wenruo Reviewed-by: David Sterba --- v5: Newly introduced. v6: Change comment to use the full length of a line. v7: None --- fs/btrfs/disk-io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f4d168d..e6285ea 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3630,6 +3630,12 @@ void close_ctree(struct btrfs_root *root) fs_info->closing = 1; smp_mb(); + /* + * Remove btrfs sysfs interfaces first, since it can start new + * transaction. + */ + btrfs_sysfs_remove_one(fs_info); + /* wait for the uuid_scan task to finish */ down(&fs_info->uuid_tree_rescan_sem); /* avoid complains from lockdep et al., set sem back to initial state */ @@ -3673,8 +3679,6 @@ void close_ctree(struct btrfs_root *root) percpu_counter_sum(&fs_info->delalloc_bytes)); } - btrfs_sysfs_remove_one(fs_info); - btrfs_free_fs_roots(fs_info); btrfs_put_block_group_cache(fs_info);