All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: miklos@szeredi.hu, raven@themaw.net, viro@ZenIV.linux.org.uk,
	torvalds@linux-foundation.org
Cc: dhowells@redhat.com, jlayton@redhat.com, gregkh@suse.de,
	linux-nfs@vger.kernel.org, leonardo.lists@gmail.com
Subject: [PATCH 6/7] VFS: Make stat and xattr calls not automount
Date: Fri, 23 Sep 2011 17:25:53 +0100	[thread overview]
Message-ID: <20110923162553.13574.77501.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20110923162438.13574.52985.stgit@warthog.procyon.org.uk>

Make stat() and get/set/list/removexattr calls not automount so that the
autofs behaviour remains the same.  This causes NFS, AFS and CIFS automounting
behaviour to change, however.

To vary the behaviour follow_automount() needs to know when it is mounting for
autofs and when the aforementioned calls are the ones being processed.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/stat.c  |    7 ++++---
 fs/xattr.c |    8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/stat.c b/fs/stat.c
index 305aa10..7fa96a1 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -80,7 +80,7 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
 		      AT_NO_AUTOMOUNT | AT_AUTOMOUNT_FOLLOW |
 		      AT_EMPTY_PATH)) != 0)
 		goto out;
-	lookup_flags = at_to_lookup_flags(flag, LOOKUP_FOLLOW_ALL);
+	lookup_flags = at_to_lookup_flags(flag, LOOKUP_FOLLOW);
 
 	error = user_path_at(dfd, filename, lookup_flags, &path);
 	if (error)
@@ -95,13 +95,14 @@ EXPORT_SYMBOL(vfs_fstatat);
 
 int vfs_stat(const char __user *name, struct kstat *stat)
 {
-	return vfs_fstatat(AT_FDCWD, name, stat, 0);
+	return vfs_fstatat(AT_FDCWD, name, stat, AT_NO_AUTOMOUNT);
 }
 EXPORT_SYMBOL(vfs_stat);
 
 int vfs_lstat(const char __user *name, struct kstat *stat)
 {
-	return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW);
+	return vfs_fstatat(AT_FDCWD, name, stat,
+			   AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT);
 }
 EXPORT_SYMBOL(vfs_lstat);
 
diff --git a/fs/xattr.c b/fs/xattr.c
index 4921010..bb9d5be 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -290,7 +290,7 @@ SYSCALL_DEFINE5(setxattr, const char __user *, pathname,
 	struct path path;
 	int error;
 
-	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW_ALL, &path);
+	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW, &path);
 	if (error)
 		return error;
 	error = mnt_want_write(path.mnt);
@@ -386,7 +386,7 @@ SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
 	struct path path;
 	ssize_t error;
 
-	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW_ALL, &path);
+	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW, &path);
 	if (error)
 		return error;
 	error = getxattr(path.dentry, name, value, size);
@@ -459,7 +459,7 @@ SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list,
 	struct path path;
 	ssize_t error;
 
-	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW_ALL, &path);
+	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW, &path);
 	if (error)
 		return error;
 	error = listxattr(path.dentry, list, size);
@@ -519,7 +519,7 @@ SYSCALL_DEFINE2(removexattr, const char __user *, pathname,
 	struct path path;
 	int error;
 
-	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW_ALL, &path);
+	error = user_path_at(AT_FDCWD, pathname, LOOKUP_FOLLOW, &path);
 	if (error)
 		return error;
 	error = mnt_want_write(path.mnt);


  parent reply	other threads:[~2011-09-23 16:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 16:24 [RFC][PATCH 0/7] Automount behaviour correction David Howells
2011-09-23 16:24 ` [PATCH 1/7] NFS4: Revert commit to make the automount code ignore LOOKUP_FOLLOW David Howells
2011-09-23 16:35   ` Linus Torvalds
2011-09-23 16:53   ` David Howells
2011-09-23 16:25 ` [PATCH 2/7] VFS: Make chown() and lchown() call fchownat() David Howells
2011-09-23 16:25 ` [PATCH 3/7] VFS: Change LOOKUP_NO_AUTOMOUNT to LOOKUP_AUTOMOUNT David Howells
2011-09-23 16:25 ` [PATCH 4/7] VFS: Move the automount suppression decision out to the initial callers of David Howells
2011-09-23 16:25 ` [PATCH 5/7] VFS: Ignore symlink following advice when pathwalking David Howells
2011-09-23 16:25 ` David Howells [this message]
2011-09-23 16:26 ` [PATCH 7/7] VFS: Vary the automounting rules for autofs David Howells
2011-09-23 16:29 ` [RFC][PATCH 0/7] Automount behaviour correction Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110923162553.13574.77501.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=gregkh@suse.de \
    --cc=jlayton@redhat.com \
    --cc=leonardo.lists@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=raven@themaw.net \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.