linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG]:bad unlock balance detected!
@ 2013-11-05  1:34 majianpeng
  2013-11-05  2:12 ` Liu Bo
  0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2013-11-05  1:34 UTC (permalink / raw)
  To: linux-btrfs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2493 bytes --]

On the mainline linux tree, the head of git is :be408cd3e1fef73e9408b196a7.

[ 2372.462131] 
[ 2372.462147] =====================================
[ 2372.462171] [ BUG: bad unlock balance detected! ]
[ 2372.462191] 3.12.0+ #32 Tainted: G        W   
[ 2372.462209] -------------------------------------
[ 2372.462228] ceph-osd/14048 is trying to release lock (sb_internal) at:
[ 2372.462275] [<ffffffffa022cb10>] btrfs_commit_transaction_async+0x1b0/0x2a0 [btrfs]
[ 2372.462305] but there are no more locks to release!
[ 2372.462324] 
[ 2372.462324] other info that might help us debug this:
[ 2372.462349] no locks held by ceph-osd/14048.
[ 2372.462367] 
[ 2372.462367] stack backtrace:
[ 2372.462386] CPU: 2 PID: 14048 Comm: ceph-osd Tainted: G        W    3.12.0+ #32
[ 2372.462414] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS 080015  11/09/2011
[ 2372.462455]  ffffffffa022cb10 ffff88007490fd28 ffffffff816f094a ffff8800378aa320
[ 2372.462491]  ffff88007490fd50 ffffffff810adf4c ffff8800378aa320 ffff88009af97650
[ 2372.462526]  ffffffffa022cb10 ffff88007490fd88 ffffffff810b01ee ffff8800898c0000
[ 2372.462562] Call Trace:
[ 2372.462584]  [<ffffffffa022cb10>] ? btrfs_commit_transaction_async+0x1b0/0x2a0 [btrfs]
[ 2372.462619]  [<ffffffff816f094a>] dump_stack+0x45/0x56
[ 2372.462642]  [<ffffffff810adf4c>] print_unlock_imbalance_bug+0xec/0x100
[ 2372.462677]  [<ffffffffa022cb10>] ? btrfs_commit_transaction_async+0x1b0/0x2a0 [btrfs]
[ 2372.462710]  [<ffffffff810b01ee>] lock_release+0x18e/0x210
[ 2372.462742]  [<ffffffffa022cb36>] btrfs_commit_transaction_async+0x1d6/0x2a0 [btrfs]
[ 2372.462783]  [<ffffffffa025a7ce>] btrfs_ioctl_start_sync+0x3e/0xc0 [btrfs]
[ 2372.462822]  [<ffffffffa025f1d3>] btrfs_ioctl+0x4c3/0x1f70 [btrfs]
[ 2372.462849]  [<ffffffff812c0321>] ? avc_has_perm+0x121/0x1b0
[ 2372.462873]  [<ffffffff812c0224>] ? avc_has_perm+0x24/0x1b0
[ 2372.462897]  [<ffffffff8107ecc8>] ? sched_clock_cpu+0xa8/0x100
[ 2372.462922]  [<ffffffff8117b145>] do_vfs_ioctl+0x2e5/0x4e0
[ 2372.462946]  [<ffffffff812c19e6>] ? file_has_perm+0x86/0xa0
[ 2372.462969]  [<ffffffff8117b3c1>] SyS_ioctl+0x81/0xa0
[ 2372.462991]  [<ffffffff817045a4>] tracesys+0xdd/0xe2
[ 2709.388375] btrfs: device fsid 983de968-d6a9-4ca9-bd27-2be472d15b9b devid 1 transid 26 /dev/sdb
[ 2709.394532] btrfs: disk space caching is enabled
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±ý»k~ÏâžØ^n‡r¡ö¦zË\x1aëh™¨è­Ú&£ûàz¿äz¹Þ—ú+€Ê+zf£¢·hšˆ§~†­†Ûiÿÿïêÿ‘êçz_è®\x0fæj:+v‰¨þ)ߣøm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG]:bad unlock balance detected!
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2013-11-05  2:12 UTC (permalink / raw)
  To: majianpeng; +Cc: linux-btrfs

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)
 		rwsem_release(
 			&root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1],
 			1, _THIS_IP_);
-- 
1.8.1.4

On Tue, Nov 05, 2013 at 09:34:01AM +0800, majianpeng wrote:
> On the mainline linux tree, the head of git is :be408cd3e1fef73e9408b196a7.
> 
> [ 2372.462131] 
> [ 2372.462147] =====================================
> [ 2372.462171] [ BUG: bad unlock balance detected! ]
> [ 2372.462191] 3.12.0+ #32 Tainted: G        W   
> [ 2372.462209] -------------------------------------
> [ 2372.462228] ceph-osd/14048 is trying to release lock (sb_internal) at:
> [ 2372.462275] [<ffffffffa022cb10>] btrfs_commit_transaction_async+0x1b0/0x2a0 [btrfs]
> [ 2372.462305] but there are no more locks to release!
> [ 2372.462324] 
> [ 2372.462324] other info that might help us debug this:
> [ 2372.462349] no locks held by ceph-osd/14048.
> [ 2372.462367] 
> [ 2372.462367] stack backtrace:
> [ 2372.462386] CPU: 2 PID: 14048 Comm: ceph-osd Tainted: G        W    3.12.0+ #32
> [ 2372.462414] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS 080015  11/09/2011
> [ 2372.462455]  ffffffffa022cb10 ffff88007490fd28 ffffffff816f094a ffff8800378aa320
> [ 2372.462491]  ffff88007490fd50 ffffffff810adf4c ffff8800378aa320 ffff88009af97650
> [ 2372.462526]  ffffffffa022cb10 ffff88007490fd88 ffffffff810b01ee ffff8800898c0000
> [ 2372.462562] Call Trace:
> [ 2372.462584]  [<ffffffffa022cb10>] ? btrfs_commit_transaction_async+0x1b0/0x2a0 [btrfs]
> [ 2372.462619]  [<ffffffff816f094a>] dump_stack+0x45/0x56
> [ 2372.462642]  [<ffffffff810adf4c>] print_unlock_imbalance_bug+0xec/0x100
> [ 2372.462677]  [<ffffffffa022cb10>] ? btrfs_commit_transaction_async+0x1b0/0x2a0 [btrfs]
> [ 2372.462710]  [<ffffffff810b01ee>] lock_release+0x18e/0x210
> [ 2372.462742]  [<ffffffffa022cb36>] btrfs_commit_transaction_async+0x1d6/0x2a0 [btrfs]
> [ 2372.462783]  [<ffffffffa025a7ce>] btrfs_ioctl_start_sync+0x3e/0xc0 [btrfs]
> [ 2372.462822]  [<ffffffffa025f1d3>] btrfs_ioctl+0x4c3/0x1f70 [btrfs]
> [ 2372.462849]  [<ffffffff812c0321>] ? avc_has_perm+0x121/0x1b0
> [ 2372.462873]  [<ffffffff812c0224>] ? avc_has_perm+0x24/0x1b0
> [ 2372.462897]  [<ffffffff8107ecc8>] ? sched_clock_cpu+0xa8/0x100
> [ 2372.462922]  [<ffffffff8117b145>] do_vfs_ioctl+0x2e5/0x4e0
> [ 2372.462946]  [<ffffffff812c19e6>] ? file_has_perm+0x86/0xa0
> [ 2372.462969]  [<ffffffff8117b3c1>] SyS_ioctl+0x81/0xa0
> [ 2372.462991]  [<ffffffff817045a4>] tracesys+0xdd/0xe2
> [ 2709.388375] btrfs: device fsid 983de968-d6a9-4ca9-bd27-2be472d15b9b devid 1 transid 26 /dev/sdb
> [ 2709.394532] btrfs: disk space caching is enabled

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [BUG]:bad unlock balance detected!
  2013-11-05  2:12 ` Liu Bo
@ 2013-11-05  2:31   ` Miao Xie
  2013-11-05  3:19     ` Liu Bo
  0 siblings, 1 reply; 4+ messages in thread
From: Miao Xie @ 2013-11-05  2:31 UTC (permalink / raw)
  To: bo.li.liu, majianpeng; +Cc: linux-btrfs

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()

>  		rwsem_release(
>  			&root->fs_info->sb->s_writers.lock_map[SB_FREEZE_FS-1],
>  			1, _THIS_IP_);
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG]:bad unlock balance detected!
  2013-11-05  2:31   ` Miao Xie
@ 2013-11-05  3:19     ` Liu Bo
  0 siblings, 0 replies; 4+ messages in thread
From: Liu Bo @ 2013-11-05  3:19 UTC (permalink / raw)
  To: Miao Xie, majianpeng; +Cc: linux-btrfs

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_);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-05  3:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).