summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-12-11 12:10:11 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 18:50:05 -0500
commit87fa55952b7347175c6e2f03874869ad2c055adb (patch)
tree8795b6a6794a1c3988cea32fb2471bd3cd235ef9 /fs
parent48f7530d3f722617aa7cfea62b09b0c1a8d0173e (diff)
downloadlinux-87fa55952b7347175c6e2f03874869ad2c055adb.tar.gz
vfs: have faccessat retry once on an ESTALE error
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/open.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index 07449b911a4d..a994ccf39b40 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -316,6 +316,7 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
 	struct path path;
 	struct inode *inode;
 	int res;
+	unsigned int lookup_flags = LOOKUP_FOLLOW;
 
 	if (mode & ~S_IRWXO)	/* where's F_OK, X_OK, W_OK, R_OK? */
 		return -EINVAL;
@@ -338,8 +339,8 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
 	}
 
 	old_cred = override_creds(override_cred);
-
-	res = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);
+retry:
+	res = user_path_at(dfd, filename, lookup_flags, &path);
 	if (res)
 		goto out;
 
@@ -374,6 +375,10 @@ SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
 
 out_path_release:
 	path_put(&path);
+	if (retry_estale(res, lookup_flags)) {
+		lookup_flags |= LOOKUP_REVAL;
+		goto retry;
+	}
 out:
 	revert_creds(old_cred);
 	put_cred(override_cred);