switch d_add_ci() to d_splice_alias() in "found negative" case as well

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2011-07-17 10:52:14 -04:00
parent 6c673ab393
commit 4513d899c4
1 changed files with 5 additions and 19 deletions

View File

@ -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 * Negative dentry: instantiate it unless the inode is a directory and
* already has a dentry. * already has a dentry.
*/ */
spin_lock(&inode->i_lock); new = d_splice_alias(inode, found);
if (!S_ISDIR(inode->i_mode) || list_empty(&inode->i_dentry)) { if (new) {
__d_instantiate(found, inode); dput(found);
spin_unlock(&inode->i_lock); found = new;
security_d_instantiate(found, inode);
return found;
} }
return found;
/*
* 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;
err_out: err_out:
iput(inode); iput(inode);