Re: context imbalance false positive sparse warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-08-19 at 15:26 -0700, Harvey Harrison wrote:
> On Tue, 2008-08-19 at 17:22 -0500, Steve French wrote:
> > On Tue, Aug 19, 2008 at 5:00 PM, Stalin Kenny <stalinlinux@xxxxxxxxx> wrote:
> > >> Even the simplest use cases throw this error e.g. fs/super.c line 162-164:
> > >>
> > >> static void put_super(struct super_block *sb)
> > >> {
> > >>       spin_lock(&sb_lock);
> > >>       __put_super(sb);
> > >>       spin_unlock(&sb_lock);
> > >> }
> > >
> > > What is the sparse error when you call this function ?
> > CHECK   fs/super.c
> > fs/super.c:164:2: warning: context imbalance in 'put_super': wrong count at exit
> > fs/super.c:164:2:    context 'lock': wanted 0, got 1
> > 
> > 
> 
> Johannes Berg had a 9-patch series that improved this somewhat, but they had
> some bugs in them (crashes).  But I've been running with them anyway as they
> do improve cases like this significantly.

I've just sent out a fixed version and with it I get no errors on
fs/super.c when I apply this small fixup:

diff --git a/fs/super.c b/fs/super.c
index e931ae9..6810845 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -201,7 +201,7 @@ EXPORT_SYMBOL(deactivate_super);
  *	success, 0 if we had failed (superblock contents was already dead or
  *	dying when grab_super() had been called).
  */
-static int grab_super(struct super_block *s) __releases(sb_lock)
+static int grab_super(struct super_block *s) __releases(&sb_lock)
 {
 	s->s_count++;
 	spin_unlock(&sb_lock);

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux