]> git.baikalelectronics.ru Git - kernel.git/commit
VFS: Remove dentry->d_lock locking from shrink_dcache_for_umount_subtree()
authorDavid Howells <dhowells@redhat.com>
Tue, 7 Jun 2011 13:09:20 +0000 (14:09 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 1 Aug 2011 06:27:57 +0000 (02:27 -0400)
commit76ff4565720d9896a84c421be3668f49ad082cd1
tree2d0924acf0c6fa37d0fc7277a9f17940496b6461
parentdbd5534cddfe2aa5dab9ab7fdffba9734aac0c12
VFS: Remove dentry->d_lock locking from shrink_dcache_for_umount_subtree()

Locks of the dcache_lock were replaced by locks of dentry->d_lock in commits
such as:

cc4ea4b8d66efaa308480fdd593f9a5425f05e6f
a7a10559024d0cd721de2928a0e8177225cd895d

as part of the RCU-based pathwalk changes, despite the fact that the caller
(shrink_dcache_for_umount()) notes in the banner comment the reasons that
d_lock is not necessary in these functions:

/*
 * destroy the dentries attached to a superblock on unmounting
 * - we don't need to use dentry->d_lock because:
 *   - the superblock is detached from all mountings and open files, so the
 *     dentry trees will not be rearranged by the VFS
 *   - s_umount is write-locked, so the memory pressure shrinker will ignore
 *     any dentries belonging to this superblock that it comes across
 *   - the filesystem itself is no longer permitted to rearrange the dentries
 *     in this superblock
 */

So remove these locks.  If the locks are actually necessary, then this banner
comment should be altered instead.

The hash table chains are protected by 1-bit locks in the hash table heads, so
those shouldn't be a problem.

Note that to make this work, __d_drop() has to be split so that the RCUwalk
barrier can be avoided.  This causes problems otherwise as it has an assertion
that dentry->d_lock is locked - but there is no need for that as no one else
can be trying to access this dentry, except to step over it (and that should
be handled by d_free(), I think).

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c