From patchwork Mon Sep 17 06:34:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 1465481 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 497DF3FE79 for ; Mon, 17 Sep 2012 06:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752019Ab2IQGfI (ORCPT ); Mon, 17 Sep 2012 02:35:08 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:8361 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751841Ab2IQGec (ORCPT ); Mon, 17 Sep 2012 02:34:32 -0400 X-IronPort-AV: E=Sophos;i="4.80,434,1344182400"; d="scan'208";a="5856436" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 17 Sep 2012 14:33:13 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id q8H6YTis021540 for ; Mon, 17 Sep 2012 14:34:29 +0800 Received: from [10.167.225.199] ([10.167.225.199]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012091714344857-882603 ; Mon, 17 Sep 2012 14:34:48 +0800 Message-ID: <5056C473.50709@cn.fujitsu.com> Date: Mon, 17 Sep 2012 14:34:27 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Linux Btrfs Subject: [PATCH] Btrfs: fix double decrease of the writer counter X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/09/17 14:34:48, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/09/17 14:34:48, Serialize complete at 2012/09/17 14:34:48 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org In __btrfs_end_transaction(), we have invoked sb_end_intwrite(), but if we need run btrfs_commit_transaction(), we will decrease the writer counter for two times because btrfs_commit_transaction() also invokes sb_end_intwrite(). Fix it. Signed-off-by: Miao Xie --- fs/btrfs/transaction.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 27c2600..3134fdc 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -551,8 +551,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, btrfs_trans_release_metadata(trans, root); trans->block_rsv = NULL; - sb_end_intwrite(root->fs_info->sb); - if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) && should_end_transaction(trans, root)) { trans->transaction->blocked = 1; @@ -573,6 +571,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, } } + sb_end_intwrite(root->fs_info->sb); + WARN_ON(cur_trans != info->running_transaction); WARN_ON(atomic_read(&cur_trans->num_writers) < 1); atomic_dec(&cur_trans->num_writers);