vfs: d_invalidate() should leave mountpoints alone
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 7 Nov 2011 16:39:57 +0000 (16:39 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 7 Nov 2011 18:54:10 +0000 (10:54 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/dcache.c

index 274f13e2f0946ed66ac186833efa1898b84db3fa..a901c6901bce1cf0a8b1823e8c87d83424594474 100644 (file)
@@ -546,9 +546,11 @@ int d_invalidate(struct dentry * dentry)
         * would make it unreachable from the root,
         * we might still populate it if it was a
         * working directory or similar).
+        * We also need to leave mountpoints alone,
+        * directory or not.
         */
-       if (dentry->d_count > 1) {
-               if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
+       if (dentry->d_count > 1 && dentry->d_inode) {
+               if (S_ISDIR(dentry->d_inode->i_mode) || d_mountpoint(dentry)) {
                        spin_unlock(&dentry->d_lock);
                        return -EBUSY;
                }