Showing error 955

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/mbcache.c
Line in file: 541
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Undetermined 1
Entered: 2012-03-02 21:35:17 UTC


Source:

511{
512        unsigned int bucket;
513        struct list_head *l;
514        struct mb_cache_entry *ce;
515
516        bucket = hash_long((unsigned long)bdev + (block & 0xffffffff),
517                           cache->c_bucket_bits);
518        spin_lock(&mb_cache_spinlock);
519        list_for_each(l, &cache->c_block_hash[bucket]) {
520                ce = list_entry(l, struct mb_cache_entry, e_block_list);
521                if (ce->e_bdev == bdev && ce->e_block == block) {
522                        DEFINE_WAIT(wait);
523
524                        if (!list_empty(&ce->e_lru_list))
525                                list_del_init(&ce->e_lru_list);
526
527                        while (ce->e_used > 0) {
528                                ce->e_queued++;
529                                prepare_to_wait(&mb_cache_queue, &wait,
530                                                TASK_UNINTERRUPTIBLE);
531                                spin_unlock(&mb_cache_spinlock);
532                                schedule();
533                                spin_lock(&mb_cache_spinlock);
534                                ce->e_queued--;
535                        }
536                        finish_wait(&mb_cache_queue, &wait);
537                        ce->e_used += 1 + MB_CACHE_WRITER;
538
539                        if (!__mb_cache_entry_is_hashed(ce)) {
540                                __mb_cache_entry_release_unlock(ce);
541                                return NULL;
542                        }
543                        goto cleanup;
544                }
545        }
546        ce = NULL;
547
548cleanup:
549        spin_unlock(&mb_cache_spinlock);
550        return ce;
551}
Show full sources