Re: [PATCH] VFS: Suppress automount on [l]stat, [l]getxattr, etc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 26, 2011 at 9:16 PM, Ian Kent <raven@xxxxxxxxxx> wrote:
>
> This case is the one were there is no existing directory yet for the
> automount (it's the age old original automount case where mount point
> directories never existed within the automount managed directory before
> being automounted). In this case we always want to automount regardless
> of the lookup flags. So returning -EISDIR should be conditional on also
> having a positive dentry.

Ok. This all just makes me more conviced that the LOOKUP_NO_AUTOMOUNT
code is not even worth trying to salvage (ie not play any games with
the existing AT_NO_AUTOMOUNT flag and perhaps turning
!AT_SYMLINK_NOFOLLOW + !AT_NOAUTOMOUNT -> LOOKUP_AUTOMOUNT). That's
the case that never tested for d_inode being NULL, so it got the
autofs case wrong.

At some point we might want to expose an AT_AUTOMOUNT flag to user
space _if_ it turns out that glibc or somebody wants really wants it,
but the old flag clearly actually had a buggy implementation and
almost certainly isn't worth worrying about.

Of course, we'll have to see if there are any actual regression
reports in this area.. If something actually breaks, we may not have
all that many choices. But at least tentatively, I think we can plan
on applying the attached cleanup to just rip that out (it's already
effectively dead code apart from the buggy lack of d_inode testing,
since apart from d_inode, it never triggers unless the subsequent test
triggers)..

                           Linus
 fs/namei.c            |    6 ------
 fs/stat.c             |    2 --
 include/linux/namei.h |    2 +-
 3 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 09606fd83d57..0b3138de2a3b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -721,12 +721,6 @@ static int follow_automount(struct path *path, unsigned flags,
 	if (!path->dentry->d_op || !path->dentry->d_op->d_automount)
 		return -EREMOTE;
 
-	/* We don't want to mount if someone supplied AT_NO_AUTOMOUNT
-	 * and this is the terminal part of the 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 -
 	 * unless they're stat'ing a directory and appended a '/' to
 	 * the name.
diff --git a/fs/stat.c b/fs/stat.c
index ba5316ffac61..78a3aa83c7ea 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -81,8 +81,6 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
 
 	if (!(flag & AT_SYMLINK_NOFOLLOW))
 		lookup_flags |= LOOKUP_FOLLOW;
-	if (flag & AT_NO_AUTOMOUNT)
-		lookup_flags |= LOOKUP_NO_AUTOMOUNT;
 	if (flag & AT_EMPTY_PATH)
 		lookup_flags |= LOOKUP_EMPTY;
 
diff --git a/include/linux/namei.h b/include/linux/namei.h
index e13dac7caab2..409328d1cbbb 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -53,7 +53,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
 #define LOOKUP_PARENT		0x0010
 #define LOOKUP_REVAL		0x0020
 #define LOOKUP_RCU		0x0040
-#define LOOKUP_NO_AUTOMOUNT	0x0080
+
 /*
  * Intent data
  */

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux