]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
VFS: Fix automount for negative autofs dentries
authorDavid Howells <dhowells@redhat.com>
Mon, 11 Jul 2011 13:20:57 +0000 (14:20 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 1 Aug 2011 05:38:01 +0000 (01:38 -0400)
Autofs may set the DCACHE_NEED_AUTOMOUNT flag on negative dentries.  These
need attention from the automounter daemon regardless of the LOOKUP_FOLLOW flag.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index f8c69d37379348973d2a12e055dbc6c61dc4cbf4..445fd5da11fa9f366458247c842d68dacb147c87 100644 (file)
@@ -716,19 +716,25 @@ static int follow_automount(struct path *path, unsigned flags,
        if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT))
                return -EISDIR; /* we actually want to stop here */
 
-       /* We want to mount if someone is trying to open/create a file of any
-        * type under the mountpoint, wants to traverse through the mountpoint
-        * or wants to open the mounted directory.
-        *
+       /*
         * We don't want to mount if someone's just doing a stat and they've
         * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and
         * appended a '/' to the name.
         */
-       if (!(flags & LOOKUP_FOLLOW) &&
-           !(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
-                      LOOKUP_OPEN | LOOKUP_CREATE)))
-               return -EISDIR;
-
+       if (!(flags & LOOKUP_FOLLOW)) {
+               /* We do, however, want to mount if someone wants to open or
+                * create a file of any type under the mountpoint, wants to
+                * traverse through the mountpoint or wants to open the mounted
+                * directory.
+                * Also, autofs may mark negative dentries as being automount
+                * points.  These will need the attentions of the daemon to
+                * instantiate them before they can be used.
+                */
+               if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
+                            LOOKUP_OPEN | LOOKUP_CREATE)) &&
+                   path->dentry->d_inode)
+                       return -EISDIR;
+       }
        current->total_link_count++;
        if (current->total_link_count >= 40)
                return -ELOOP;