linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: automount should ignore LOOKUP_FOLLOW
@ 2011-09-05 16:06 Miklos Szeredi
  2011-09-05 16:37 ` David Howells
  2011-09-22 12:29 ` Jeff Layton
  0 siblings, 2 replies; 18+ messages in thread
From: Miklos Szeredi @ 2011-09-05 16:06 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: Leonardo Chiquitto, David Howells, Ian Kent, Al Viro,
	Linus Torvalds, autofs

From: Miklos Szeredi <mszeredi@suse.cz>

Prior to 2.6.38 automount would not trigger on either stat(2) or
lstat(2) on the automount point.

After 2.6.38, with the introduction of the ->d_automount()
infrastructure, stat(2) and others would start triggering automount
while lstat(2), etc. still would not.  This is a regression and a
userspace ABI change.

Problem originally reported here:

  http://thread.gmane.org/gmane.linux.kernel.autofs/6098

It appears that there was an attempt at fixing various userspace tools
to not trigger the automount.  But since the stat system call is
rather common it is impossible to "fix" all userspace.

This patch reverts the original behavior, which is to not trigger on
stat(2) and other symlink following syscalls.

Reported-by: Leonardo Chiquitto <leonardo.lists@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: David Howells <dhowells@redhat.com>
CC: Ian Kent <raven@themaw.net>
CC: stable@kernel.org
---
 fs/namei.c |   33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

Index: linux-2.6/fs/namei.c
===================================================================
--- linux-2.6.orig/fs/namei.c	2011-09-05 14:37:25.000000000 +0200
+++ linux-2.6/fs/namei.c	2011-09-05 17:31:14.000000000 +0200
@@ -727,25 +727,22 @@ static int follow_automount(struct path
 	if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT))
 		return -EISDIR; /* we actually want to stop here */
 
-	/*
-	 * 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.
+	/* We don't want to mount if someone's just doing a stat -
+	 * unless they're stat'ing a directory and appended a '/' to
+	 * the name.
+	 *
+	 * 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_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;
-	}
+	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;

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-09-22 12:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-05 16:06 [PATCH] vfs: automount should ignore LOOKUP_FOLLOW Miklos Szeredi
2011-09-05 16:37 ` David Howells
2011-09-05 17:02   ` Miklos Szeredi
2011-09-06  3:53     ` Ian Kent
2011-09-06  4:03       ` Ian Kent
2011-09-06  8:09       ` Miklos Szeredi
2011-09-06 14:38         ` Ian Kent
2011-09-06 15:39           ` Miklos Szeredi
2011-09-08 12:36             ` Ian Kent
2011-09-08 13:38               ` Miklos Szeredi
2011-09-08 17:42                 ` Linus Torvalds
2011-09-08 19:50                   ` Al Viro
2011-09-08 20:19                     ` Linus Torvalds
2011-09-08 21:54                       ` Al Viro
2011-09-09  3:37                         ` Ian Kent
2011-09-09  3:33                   ` Ian Kent
2011-09-09  3:18                 ` Ian Kent
2011-09-22 12:29 ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).