From: Liu Bo <bo.li.liu@oracle.com>
To: Miao Xie <miaox@cn.fujitsu.com>, majianpeng <majianpeng@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [BUG]:bad unlock balance detected!
Date: Tue, 5 Nov 2013 11:19:09 +0800 [thread overview]
Message-ID: <20131105031908.GB15974@localhost.localdomain> (raw)
In-Reply-To: <52785873.6050106@cn.fujitsu.com>
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 <bo.li.liu@oracle.com>
> > 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 <bo.li.liu@oracle.com>
> > ---
> > 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
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],
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_);
prev parent reply other threads:[~2013-11-05 3:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 1:34 [BUG]:bad unlock balance detected! majianpeng
2013-11-05 2:12 ` Liu Bo
2013-11-05 2:31 ` Miao Xie
2013-11-05 3:19 ` Liu Bo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131105031908.GB15974@localhost.localdomain \
--to=bo.li.liu@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=majianpeng@gmail.com \
--cc=miaox@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).