Showing error 996

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


Source:

533 * restriction, but since most clients simply want to get, set or test a member
534 * of the returned data structure, the extra per-element memory isn't warranted.
535 *
536 * If the element isn't found, this function returns NULL and the spinlock is
537 * released.  xfs_mru_cache_done() should NOT be called when this occurs.
538 *
539 * Because sparse isn't smart enough to know about conditional lock return
540 * status, we need to help it get it right by annotating the path that does
541 * not release the lock.
542 */
543void *
544xfs_mru_cache_lookup(
545        xfs_mru_cache_t        *mru,
546        unsigned long        key)
547{
548        xfs_mru_cache_elem_t *elem;
549
550        ASSERT(mru && mru->lists);
551        if (!mru || !mru->lists)
552                return NULL;
553
554        spin_lock(&mru->lock);
555        elem = radix_tree_lookup(&mru->store, key);
556        if (elem) {
557                list_del(&elem->list_node);
558                _xfs_mru_cache_list_insert(mru, elem);
559                __release(mru_lock); /* help sparse not be stupid */
560        } else
561                spin_unlock(&mru->lock);
562
563        return elem ? elem->value : NULL;
564}
565
566/*
567 * To look up an element using its key, but leave its location in the internal
568 * lists alone, call xfs_mru_cache_peek().  If the element isn't found, this
569 * function returns NULL.
570 *
571 * See the comments above the declaration of the xfs_mru_cache_lookup() function
572 * for important locking information pertaining to this call.
573 */
Show full sources