aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2011-09-05 12:06:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-09-09 18:42:34 -0400
commit0ec26fd0698285b31248e34bf1abb022c00f23d6 (patch)
tree1d144b5b749a510e819ab0dfb624f3676e9991e9
parente4e436e0bd480668834fe6849a52c5397b7be4fb (diff)
vfs: automount should ignore LOOKUP_FOLLOW
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. [ It's not really clear what the right behavior is. Apparently Solaris does the "automount on stat, leave alone on lstat". And some programs can get unhappy when "stat+open+fstat" ends up giving a different result from the fstat than from the initial stat. But the change in 2.6.38 resulted in problems for some people, so we're going back to old behavior. Maybe we can re-visit this discussion at some future date - Linus ] Reported-by: Leonardo Chiquitto <leonardo.lists@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Acked-by: Ian Kent <raven@themaw.net> Cc: David Howells <dhowells@redhat.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/namei.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 2826db35dc25..b52bc685465f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -727,25 +727,22 @@ static int follow_automount(struct path *path, unsigned flags,
727 if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) 727 if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT))
728 return -EISDIR; /* we actually want to stop here */ 728 return -EISDIR; /* we actually want to stop here */
729 729
730 /* 730 /* We don't want to mount if someone's just doing a stat -
731 * We don't want to mount if someone's just doing a stat and they've 731 * unless they're stat'ing a directory and appended a '/' to
732 * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and 732 * the name.
733 * appended a '/' to the name. 733 *
734 * We do, however, want to mount if someone wants to open or
735 * create a file of any type under the mountpoint, wants to
736 * traverse through the mountpoint or wants to open the
737 * mounted directory. Also, autofs may mark negative dentries
738 * as being automount points. These will need the attentions
739 * of the daemon to instantiate them before they can be used.
734 */ 740 */
735 if (!(flags & LOOKUP_FOLLOW)) { 741 if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
736 /* We do, however, want to mount if someone wants to open or 742 LOOKUP_OPEN | LOOKUP_CREATE)) &&
737 * create a file of any type under the mountpoint, wants to 743 path->dentry->d_inode)
738 * traverse through the mountpoint or wants to open the mounted 744 return -EISDIR;
739 * directory. 745
740 * Also, autofs may mark negative dentries as being automount
741 * points. These will need the attentions of the daemon to
742 * instantiate them before they can be used.
743 */
744 if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
745 LOOKUP_OPEN | LOOKUP_CREATE)) &&
746 path->dentry->d_inode)
747 return -EISDIR;
748 }
749 current->total_link_count++; 746 current->total_link_count++;
750 if (current->total_link_count >= 40) 747 if (current->total_link_count >= 40)
751 return -ELOOP; 748 return -ELOOP;