Showing error 1327

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: fs/inode.c
Line in file: 1333
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-05-21 20:30:05 UTC


Source:

1303 * It doesn't matter if I_LOCK is not set initially, a call to
1304 * wake_up_inode() after removing from the hash list will DTRT.
1305 *
1306 * This is called with inode_lock held.
1307 */
1308static void __wait_on_freeing_inode(struct inode *inode)
1309{
1310        wait_queue_head_t *wq;
1311        DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK);
1312        wq = bit_waitqueue(&inode->i_state, __I_LOCK);
1313        prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
1314        spin_unlock(&inode_lock);
1315        schedule();
1316        finish_wait(wq, &wait.wait);
1317        spin_lock(&inode_lock);
1318}
1319
1320/*
1321 * We rarely want to lock two inodes that do not have a parent/child
1322 * relationship (such as directory, child inode) simultaneously. The
1323 * vast majority of file systems should be able to get along fine
1324 * without this. Do not use these functions except as a last resort.
1325 */
1326void inode_double_lock(struct inode *inode1, struct inode *inode2)
1327{
1328        if (inode1 == NULL || inode2 == NULL || inode1 == inode2) {
1329                if (inode1)
1330                        mutex_lock(&inode1->i_mutex);
1331                else if (inode2)
1332                        mutex_lock(&inode2->i_mutex);
1333                return;
1334        }
1335
1336        if (inode1 < inode2) {
1337                mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT);
1338                mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD);
1339        } else {
1340                mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT);
1341                mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD);
1342        }
1343}
Show full sources