LKML Archive mirror
 help / color / mirror / Atom feed
* Possible deadlock in jfs_imap.c?
@ 2009-05-23 15:19 Jan Kucera
  2009-05-24  1:26 ` Dave Kleikamp
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kucera @ 2009-05-23 15:19 UTC (permalink / raw
  To: jfs-discussion; +Cc: shaggy, linux-kernel

Hi,

for my master thesis, I've designed static checker for finding deadlocks in C.
My tool found some possible deadlock in file fs/jfs/jfs_imap.c
between JFS_IP(ipimap)->commit_mutex and  imap->im_aglock[agno].

Reason of this problem is probably missed unlocking of
JFS_IP(ipimap)->commit_mutex in branch starting at line 2564 which
leaves JFS_IP(ipimap)->commit_mutex locked:

    in function diNewIAG(..)
        locking mutex_lock(&JFS_IP(ipimap)->commit_mutex) at line 2540
        condition at line 2543 is false
        condition at line 2564 is true
        goto out: at 2579
        IAGFREE_UNLOCK(imap); at line 2654
    return from diNewIAG(..) at line 2656

Version of kernel is 2.6.28 (maybe this code is in newer versions too).
Could someone confirm, that this is a real bug? Thank you for your time.

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

* Re: Possible deadlock in jfs_imap.c?
  2009-05-23 15:19 Possible deadlock in jfs_imap.c? Jan Kucera
@ 2009-05-24  1:26 ` Dave Kleikamp
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Kleikamp @ 2009-05-24  1:26 UTC (permalink / raw
  To: Jan Kucera; +Cc: JFS Discussion, linux-kernel

On Sat, 2009-05-23 at 17:19 +0200, Jan Kucera wrote:
> Hi,
> 
> for my master thesis, I've designed static checker for finding deadlocks in C.
> My tool found some possible deadlock in file fs/jfs/jfs_imap.c
> between JFS_IP(ipimap)->commit_mutex and  imap->im_aglock[agno].
> 
> Reason of this problem is probably missed unlocking of
> JFS_IP(ipimap)->commit_mutex in branch starting at line 2564 which
> leaves JFS_IP(ipimap)->commit_mutex locked:
> 
>     in function diNewIAG(..)
>         locking mutex_lock(&JFS_IP(ipimap)->commit_mutex) at line 2540
>         condition at line 2543 is false
>         condition at line 2564 is true
>         goto out: at 2579
>         IAGFREE_UNLOCK(imap); at line 2654
>     return from diNewIAG(..) at line 2656
> 
> Version of kernel is 2.6.28 (maybe this code is in newer versions too).
> Could someone confirm, that this is a real bug? Thank you for your time.

Yes, it looks like a real bug.  As the comment states, it's an unlikely
error path. This would explain how it went undetected this long.  Should
be fixed anyway.

Thanks,
Shaggy
-- 
David Kleikamp
IBM Linux Technology Center


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

end of thread, other threads:[~2009-05-24  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-23 15:19 Possible deadlock in jfs_imap.c? Jan Kucera
2009-05-24  1:26 ` Dave Kleikamp

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 read-only IMAP folder(s) and NNTP newsgroup(s).