Skip to content

Commit 50e6963

Browse files
Al Virotorvalds
authored andcommitted
vfs: d_invalidate() should leave mountpoints alone
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent a844506 commit 50e6963

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/dcache.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,11 @@ int d_invalidate(struct dentry * dentry)
546546
* would make it unreachable from the root,
547547
* we might still populate it if it was a
548548
* working directory or similar).
549+
* We also need to leave mountpoints alone,
550+
* directory or not.
549551
*/
550-
if (dentry->d_count > 1) {
551-
if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
552+
if (dentry->d_count > 1 && dentry->d_inode) {
553+
if (S_ISDIR(dentry->d_inode->i_mode) || d_mountpoint(dentry)) {
552554
spin_unlock(&dentry->d_lock);
553555
return -EBUSY;
554556
}

0 commit comments

Comments
 (0)