Skip to content

Commit

Permalink
vfs: fix linkat to retry once on ESTALE errors
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Jeff Layton authored and Al Viro committed Dec 20, 2012
1 parent f46d356 commit 442e31c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit 442e31c

Please sign in to comment.