Skip to contentSkip to conversation

Possible deadlock in jfs_imap.c?

DISCUSSION Jan Kucera 2 participants 2 messages May 23, 2009 – May 24, 2009

lore
Share & tools
lore

Jan Kucera

author
#0 lore raw

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.

#1 lore raw
Quoted 18 lines · Jan Kucera

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

Quoted 2 lines

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

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center