summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-17 18:52:14 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-21 04:48:02 +0400
commit4513d899c418ff69052420e29e354e4c64b3ef76 (patch)
treeffe11084d28c4a3d7b4eaa745748539c2eff2fb4 /fs
parent6c673ab393bc18e8bff729cd04cf384d15e72a04 (diff)
downloadlinux-4513d899c418ff69052420e29e354e4c64b3ef76.tar.xz
switch d_add_ci() to d_splice_alias() in "found negative" case as well
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/dcache.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 2762804a140d..d1d6b3349ec7 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1652,26 +1652,12 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
* Negative dentry: instantiate it unless the inode is a directory and
* already has a dentry.
*/
- spin_lock(&inode->i_lock);
- if (!S_ISDIR(inode->i_mode) || list_empty(&inode->i_dentry)) {
- __d_instantiate(found, inode);
- spin_unlock(&inode->i_lock);
- security_d_instantiate(found, inode);
- return found;
+ new = d_splice_alias(inode, found);
+ if (new) {
+ dput(found);
+ found = new;
}
-
- /*
- * In case a directory already has a (disconnected) entry grab a
- * reference to it, move it in place and use it.
- */
- new = list_entry(inode->i_dentry.next, struct dentry, d_alias);
- __dget(new);
- spin_unlock(&inode->i_lock);
- security_d_instantiate(found, inode);
- d_move(new, found);
- iput(inode);
- dput(found);
- return new;
+ return found;
err_out:
iput(inode);