Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 231509
b: refs/heads/master
c: 6f45b65
h: refs/heads/master
i:
  231507: 05866e2
v: v3
  • Loading branch information
David Howells authored and Al Viro committed Jan 16, 2011
1 parent 6b05ba7 commit cd5a9c0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc53ce53c86924bfe98a12ea20b7465038a08792
refs/heads/master: 6f45b65672c8017d5e210e338bb5858a938ef445
6 changes: 6 additions & 0 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,12 @@ 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_CONTINUE))
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.
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
int error = -EINVAL;
int lookup_flags = 0;

if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0)
goto out;

if (!(flag & AT_SYMLINK_NOFOLLOW))
lookup_flags |= LOOKUP_FOLLOW;
if (flag & AT_NO_AUTOMOUNT)
lookup_flags |= LOOKUP_NO_AUTOMOUNT;

error = user_path_at(dfd, filename, lookup_flags, &path);
if (error)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#define AT_REMOVEDIR 0x200 /* Remove directory instead of
unlinking file. */
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */

#ifdef __KERNEL__

Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/namei.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
* - ending slashes ok even for nonexistent files
* - internal "there are more path components" flag
* - dentry cache is untrusted; force a real lookup
* - suppress terminal automount
*/
#define LOOKUP_FOLLOW 0x0001
#define LOOKUP_DIRECTORY 0x0002
Expand All @@ -53,6 +54,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
*/
Expand Down

0 comments on commit cd5a9c0

Please sign in to comment.