From patchwork Tue Nov 5 03:19:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 3138971 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D8A29BEEB2 for ; Tue, 5 Nov 2013 03:19:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A00A205EA for ; Tue, 5 Nov 2013 03:19:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 934C0205DD for ; Tue, 5 Nov 2013 03:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753412Ab3KEDTV (ORCPT ); Mon, 4 Nov 2013 22:19:21 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:38745 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732Ab3KEDTV (ORCPT ); Mon, 4 Nov 2013 22:19:21 -0500 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rA53JF0s005386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Nov 2013 03:19:16 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rA53JElp008294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Nov 2013 03:19:15 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rA53JE0f006248; Tue, 5 Nov 2013 03:19:14 GMT Received: from localhost.localdomain (/10.182.228.124) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Nov 2013 19:19:13 -0800 Date: Tue, 5 Nov 2013 11:19:09 +0800 From: Liu Bo To: Miao Xie , majianpeng Cc: linux-btrfs Subject: Re: [BUG]:bad unlock balance detected! Message-ID: <20131105031908.GB15974@localhost.localdomain> Reply-To: bo.li.liu@oracle.com References: <201311050933582618320@gmail.com> <20131105021216.GA15974@localhost.localdomain> <52785873.6050106@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <52785873.6050106@cn.fujitsu.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet21.oracle.com [156.151.31.93] 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, 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 On Tue, Nov 05, 2013 at 10:31:15AM +0800, Miao Xie wrote: > On tue, 5 Nov 2013 10:12:17 +0800, Liu Bo wrote: > > Hi, > > > > Would you please try the following patch? > > > > -liubo > > > > From: Liu Bo > > Subject: [PATCH] Btrfs: fix to use the right trans for async commit > > > > @trans has been freed and is undefined, and we should use the trans > > handle created for async commit instead. > > > > Signed-off-by: Liu Bo > > --- > > fs/btrfs/transaction.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c > > index 8c81bdc..648d839 100644 > > --- a/fs/btrfs/transaction.c > > +++ b/fs/btrfs/transaction.c > > @@ -1494,7 +1494,7 @@ int btrfs_commit_transaction_async(struct > > btrfs_trans_handle *trans, > > * Tell lockdep we've released the freeze rwsem, since the > > * async commit thread will be the one to unlock it. > > */ > > - if (trans->type < TRANS_JOIN_NOLOCK) > > + if (ac->newtrans->type < TRANS_JOIN_NOLOCK) > > It should be: > > if (trans->type & __TRANS_FREEZABLE) > > The same for > > do_async_commit() Make sense, I missed that we've grabbed a reference on trans. Ma, Sorry for the previous noise, but could you please try the following one instead? -liubo 0, 1, _THIS_IP_); @@ -1494,7 +1494,7 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, * Tell lockdep we've released the freeze rwsem, since the * async commit thread will be the one to unlock it. */ - if (trans->type < TRANS_JOIN_NOLOCK) + if (ac->newtrans->type & __TRANS_FREEZABLE) rwsem_release( &root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1], 1, _THIS_IP_); --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8c81bdc..c094f08 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1453,7 +1453,7 @@ static void do_async_commit(struct work_struct *work) * We've got freeze protection passed with the transaction. * Tell lockdep about it. */ - if (ac->newtrans->type < TRANS_JOIN_NOLOCK) + if (ac->newtrans->type & __TRANS_FREEZABLE) rwsem_acquire_read( &ac->root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1],