summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-12-11 12:10:12 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 18:50:06 -0500
commit0291c0a551d5b0856627f2cb294da05f122414a0 (patch)
tree1dce5d588af3ddc3d8c61fdc3a02e921830b75e7 /fs/open.c
parent87fa55952b7347175c6e2f03874869ad2c055adb (diff)
downloadlinux-3.10-0291c0a551d5b0856627f2cb294da05f122414a0.tar.gz
linux-3.10-0291c0a551d5b0856627f2cb294da05f122414a0.tar.bz2
linux-3.10-0291c0a551d5b0856627f2cb294da05f122414a0.zip
vfs: have chdir retry lookup and call once on ESTALE error
Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index a994ccf39b4..402dfcb6720 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -394,8 +394,9 @@ SYSCALL_DEFINE1(chdir, const char __user *, filename)
{
struct path path;
int error;
-
- error = user_path_dir(filename, &path);
+ unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
+retry:
+ error = user_path_at(AT_FDCWD, filename, lookup_flags, &path);
if (error)
goto out;
@@ -407,6 +408,10 @@ SYSCALL_DEFINE1(chdir, const char __user *, filename)
dput_and_out:
path_put(&path);
+ if (retry_estale(error, lookup_flags)) {
+ lookup_flags |= LOOKUP_REVAL;
+ goto retry;
+ }
out:
return error;
}