Commit 4513d899c418ff69052420e29e354e4c64b3ef76
1 parent
6c673ab393
Exists in
master
and in
6 other branches
switch d_add_ci() to d_splice_alias() in "found negative" case as well
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 5 additions and 19 deletions Side-by-side Diff
fs/dcache.c
... | ... | @@ -1652,26 +1652,12 @@ |
1652 | 1652 | * Negative dentry: instantiate it unless the inode is a directory and |
1653 | 1653 | * already has a dentry. |
1654 | 1654 | */ |
1655 | - spin_lock(&inode->i_lock); | |
1656 | - if (!S_ISDIR(inode->i_mode) || list_empty(&inode->i_dentry)) { | |
1657 | - __d_instantiate(found, inode); | |
1658 | - spin_unlock(&inode->i_lock); | |
1659 | - security_d_instantiate(found, inode); | |
1660 | - return found; | |
1655 | + new = d_splice_alias(inode, found); | |
1656 | + if (new) { | |
1657 | + dput(found); | |
1658 | + found = new; | |
1661 | 1659 | } |
1662 | - | |
1663 | - /* | |
1664 | - * In case a directory already has a (disconnected) entry grab a | |
1665 | - * reference to it, move it in place and use it. | |
1666 | - */ | |
1667 | - new = list_entry(inode->i_dentry.next, struct dentry, d_alias); | |
1668 | - __dget(new); | |
1669 | - spin_unlock(&inode->i_lock); | |
1670 | - security_d_instantiate(found, inode); | |
1671 | - d_move(new, found); | |
1672 | - iput(inode); | |
1673 | - dput(found); | |
1674 | - return new; | |
1660 | + return found; | |
1675 | 1661 | |
1676 | 1662 | err_out: |
1677 | 1663 | iput(inode); |