Showing error 895

User: Jiri Slaby
Error type: Double Lock
Error type description: Some lock is locked twice unintentionally in a sequence
File location: fs/dcache.c
Line in file: 442
Project: Linux Kernel
Project version: 2.6.28
Tools: Undetermined 1
Clang Static Analyzer (3.0)
Smatch (1.59)
Entered: 2012-02-27 21:22:42 UTC


Source:

 412/*
 413 * Throw away a dentry - free the inode, dput the parent.  This requires that
 414 * the LRU list has already been removed.
 415 *
 416 * Try to prune ancestors as well.  This is necessary to prevent
 417 * quadratic behavior of shrink_dcache_parent(), but is also expected
 418 * to be beneficial in reducing dentry cache fragmentation.
 419 */
 420static void prune_one_dentry(struct dentry * dentry)
 421        __releases(dentry->d_lock)
 422        __releases(dcache_lock)
 423        __acquires(dcache_lock)
 424{
 425        __d_drop(dentry);
 426        dentry = d_kill(dentry);
 427
 428        /*
 429         * Prune ancestors.  Locking is simpler than in dput(),
 430         * because dcache_lock needs to be taken anyway.
 431         */
 432        spin_lock(&dcache_lock);
 433        while (dentry) {
 434                if (!atomic_dec_and_lock(&dentry->d_count, &dentry->d_lock))
 435                        return;
 436
 437                if (dentry->d_op && dentry->d_op->d_delete)
 438                        dentry->d_op->d_delete(dentry);
 439                dentry_lru_del_init(dentry);
 440                __d_drop(dentry);
 441                dentry = d_kill(dentry);
 442                spin_lock(&dcache_lock);
 443        }
 444}
 445
 446/*
 447 * Shrink the dentry LRU on a given superblock.
 448 * @sb   : superblock to shrink dentry LRU.
 449 * @count: If count is NULL, we prune all dentries on superblock.
 450 * @flags: If flags is non-zero, we need to do special processing based on
 451 * which flags are set. This means we don't need to maintain multiple
 452 * similar copies of this loop.
Show full sources