All of lore.kernel.org
 help / color / mirror / Atom feed
* Sparse Warnings about locks in extent-tree.c
@ 2014-09-23  1:57 nick
  2014-09-23  6:45 ` Liu Bo
  0 siblings, 1 reply; 4+ messages in thread
From: nick @ 2014-09-23  1:57 UTC (permalink / raw)
  To: linux-btrfs

Hello Btfs Developers,
I am new so am unsure of how to fix this but we are hitting some sparse warnings about unlock/lock is having 
a wrong count when exiting certain functions in extent-tree.c. I will paste the warnings below for you guys.
Hope this is of help.
Cheers,
Nick  
fs/btrfs/extent-tree.c:6386:39: warning: context imbalance in 'btrfs_lock_cluster' - wrong count at exit
fs/btrfs/extent-tree.c:6663:44: warning: context imbalance in 'find_free_extent' - unexpected unlock
fs/btrfs/extent-tree.c:8810:9: warning: context imbalance in 'btrfs_put_block_group_cache' - wrong count at exit

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

* Re: Sparse Warnings about locks in extent-tree.c
  2014-09-23  1:57 Sparse Warnings about locks in extent-tree.c nick
@ 2014-09-23  6:45 ` Liu Bo
  2014-09-23 14:01   ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Bo @ 2014-09-23  6:45 UTC (permalink / raw)
  To: nick; +Cc: linux-btrfs

On Mon, Sep 22, 2014 at 09:57:35PM -0400, nick wrote:
> Hello Btfs Developers,
> I am new so am unsure of how to fix this but we are hitting some sparse warnings about unlock/lock is having 
> a wrong count when exiting certain functions in extent-tree.c. I will paste the warnings below for you guys.
> Hope this is of help.
> Cheers,
> Nick  
> fs/btrfs/extent-tree.c:6386:39: warning: context imbalance in 'btrfs_lock_cluster' - wrong count at exit
> fs/btrfs/extent-tree.c:6663:44: warning: context imbalance in 'find_free_extent' - unexpected unlock
> fs/btrfs/extent-tree.c:8810:9: warning: context imbalance in 'btrfs_put_block_group_cache' - wrong count at exit

Hi Nick,

What program is producing these warning?  It looks like a static code analysis
tool or something.

thanks,
-liubo

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

* Re: Sparse Warnings about locks in extent-tree.c
  2014-09-23  6:45 ` Liu Bo
@ 2014-09-23 14:01   ` David Sterba
  2014-09-23 14:07     ` Liu Bo
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2014-09-23 14:01 UTC (permalink / raw)
  To: Liu Bo; +Cc: nick, linux-btrfs

On Tue, Sep 23, 2014 at 02:45:44PM +0800, Liu Bo wrote:
> On Mon, Sep 22, 2014 at 09:57:35PM -0400, nick wrote:
> > Hello Btfs Developers,
> > I am new so am unsure of how to fix this but we are hitting some sparse warnings about unlock/lock is having 
> > a wrong count when exiting certain functions in extent-tree.c. I will paste the warnings below for you guys.
> > Hope this is of help.
> > Cheers,
> > Nick  
> > fs/btrfs/extent-tree.c:6386:39: warning: context imbalance in 'btrfs_lock_cluster' - wrong count at exit
> > fs/btrfs/extent-tree.c:6663:44: warning: context imbalance in 'find_free_extent' - unexpected unlock
> > fs/btrfs/extent-tree.c:8810:9: warning: context imbalance in 'btrfs_put_block_group_cache' - wrong count at exit
> 
> What program is producing these warning?  It looks like a static code analysis
> tool or something.

https://sparse.wiki.kernel.org/index.php/Main_Page

It understands a few semantics like the locking and reports when there's
an unannotated function that has imbalanced locking, like the errors
above.

Any static analyzer has some ratio of false positives so not every
report means there's a bug. One would expect that a function
'btrfs_lock_cluster' would act as a lock and leaves some locks held at
exit. The "fix" is to annotate it a after review.

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

* Re: Sparse Warnings about locks in extent-tree.c
  2014-09-23 14:01   ` David Sterba
@ 2014-09-23 14:07     ` Liu Bo
  0 siblings, 0 replies; 4+ messages in thread
From: Liu Bo @ 2014-09-23 14:07 UTC (permalink / raw)
  To: dsterba, nick, linux-btrfs

On Tue, Sep 23, 2014 at 04:01:41PM +0200, David Sterba wrote:
> On Tue, Sep 23, 2014 at 02:45:44PM +0800, Liu Bo wrote:
> > On Mon, Sep 22, 2014 at 09:57:35PM -0400, nick wrote:
> > > Hello Btfs Developers,
> > > I am new so am unsure of how to fix this but we are hitting some sparse warnings about unlock/lock is having 
> > > a wrong count when exiting certain functions in extent-tree.c. I will paste the warnings below for you guys.
> > > Hope this is of help.
> > > Cheers,
> > > Nick  
> > > fs/btrfs/extent-tree.c:6386:39: warning: context imbalance in 'btrfs_lock_cluster' - wrong count at exit
> > > fs/btrfs/extent-tree.c:6663:44: warning: context imbalance in 'find_free_extent' - unexpected unlock
> > > fs/btrfs/extent-tree.c:8810:9: warning: context imbalance in 'btrfs_put_block_group_cache' - wrong count at exit
> > 
> > What program is producing these warning?  It looks like a static code analysis
> > tool or something.
> 
> https://sparse.wiki.kernel.org/index.php/Main_Page
> 
> It understands a few semantics like the locking and reports when there's
> an unannotated function that has imbalanced locking, like the errors
> above.

Cool, thanks Dave.

-liubo

> 
> Any static analyzer has some ratio of false positives so not every
> report means there's a bug. One would expect that a function
> 'btrfs_lock_cluster' would act as a lock and leaves some locks held at
> exit. The "fix" is to annotate it a after review.

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

end of thread, other threads:[~2014-09-23 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23  1:57 Sparse Warnings about locks in extent-tree.c nick
2014-09-23  6:45 ` Liu Bo
2014-09-23 14:01   ` David Sterba
2014-09-23 14:07     ` Liu Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.