aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-07-26 13:33:16 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-26 13:41:14 -0400
commitc46c887744b330795eba55fdb96343c36d481765 (patch)
tree3e4608981b87d8b5d2b23827988312d7c35778b2 /fs/dcache.c
parent41c96486f238e6a545f52215f95fe69748abf603 (diff)
vfs: document locking requirements for d_move, __d_move and d_materialise_unique
Adding a comment to d_materialise_unique per Al's request... d_move and __d_move have some pretty substantial locking requirements, but they are not clearly documented. Add some comments spelling them out. Also, document the requirement for the i_mutex of the parent in d_materialise_unique. Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index be18598c7fd7..b05aac3a8cfc 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2138,8 +2138,9 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry,
2138 * @target: new dentry 2138 * @target: new dentry
2139 * 2139 *
2140 * Update the dcache to reflect the move of a file name. Negative 2140 * Update the dcache to reflect the move of a file name. Negative
2141 * dcache entries should not be moved in this way. Caller hold 2141 * dcache entries should not be moved in this way. Caller must hold
2142 * rename_lock. 2142 * rename_lock, the i_mutex of the source and target directories,
2143 * and the sb->s_vfs_rename_mutex if they differ. See lock_rename().
2143 */ 2144 */
2144static void __d_move(struct dentry * dentry, struct dentry * target) 2145static void __d_move(struct dentry * dentry, struct dentry * target)
2145{ 2146{
@@ -2202,7 +2203,8 @@ static void __d_move(struct dentry * dentry, struct dentry * target)
2202 * @target: new dentry 2203 * @target: new dentry
2203 * 2204 *
2204 * Update the dcache to reflect the move of a file name. Negative 2205 * Update the dcache to reflect the move of a file name. Negative
2205 * dcache entries should not be moved in this way. 2206 * dcache entries should not be moved in this way. See the locking
2207 * requirements for __d_move.
2206 */ 2208 */
2207void d_move(struct dentry *dentry, struct dentry *target) 2209void d_move(struct dentry *dentry, struct dentry *target)
2208{ 2210{
@@ -2320,7 +2322,8 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
2320 * @inode: inode to bind to the dentry, to which aliases may be attached 2322 * @inode: inode to bind to the dentry, to which aliases may be attached
2321 * 2323 *
2322 * Introduces an dentry into the tree, substituting an extant disconnected 2324 * Introduces an dentry into the tree, substituting an extant disconnected
2323 * root directory alias in its place if there is one 2325 * root directory alias in its place if there is one. Caller must hold the
2326 * i_mutex of the parent directory.
2324 */ 2327 */
2325struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) 2328struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2326{ 2329{