summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-12-20 16:15:38 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 18:50:03 -0500
commit442e31ca5a49e398351b2954b51f578353fdf210 (patch)
tree69563d0ac90bc88e140d9c82efc75e44bddd2618 /fs
parentf46d3567b223e41e1f2faeb82d3b74a6d84fc508 (diff)
downloadlinux-stable-442e31ca5a49e398351b2954b51f578353fdf210.tar.gz
linux-stable-442e31ca5a49e398351b2954b51f578353fdf210.tar.bz2
linux-stable-442e31ca5a49e398351b2954b51f578353fdf210.zip
vfs: fix linkat to retry once on ESTALE errors
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/namei.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index b06a111591a8..6868699272bf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3626,12 +3626,13 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
if (flags & AT_SYMLINK_FOLLOW)
how |= LOOKUP_FOLLOW;
-
+retry:
error = user_path_at(olddfd, oldname, how, &old_path);
if (error)
return error;
- new_dentry = user_path_create(newdfd, newname, &new_path, 0);
+ new_dentry = user_path_create(newdfd, newname, &new_path,
+ (how & LOOKUP_REVAL));
error = PTR_ERR(new_dentry);
if (IS_ERR(new_dentry))
goto out;
@@ -3648,6 +3649,10 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry);
out_dput:
done_path_create(&new_path, new_dentry);
+ if (retry_estale(error, how)) {
+ how |= LOOKUP_REVAL;
+ goto retry;
+ }
out:
path_put(&old_path);