diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-12-20 16:15:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 18:50:03 -0500 |
commit | 442e31ca5a49e398351b2954b51f578353fdf210 (patch) | |
tree | 69563d0ac90bc88e140d9c82efc75e44bddd2618 | |
parent | f46d3567b223e41e1f2faeb82d3b74a6d84fc508 (diff) |
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>
-rw-r--r-- | fs/namei.c | 9 |
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, | |||
3626 | 3626 | ||
3627 | if (flags & AT_SYMLINK_FOLLOW) | 3627 | if (flags & AT_SYMLINK_FOLLOW) |
3628 | how |= LOOKUP_FOLLOW; | 3628 | how |= LOOKUP_FOLLOW; |
3629 | 3629 | retry: | |
3630 | error = user_path_at(olddfd, oldname, how, &old_path); | 3630 | error = user_path_at(olddfd, oldname, how, &old_path); |
3631 | if (error) | 3631 | if (error) |
3632 | return error; | 3632 | return error; |
3633 | 3633 | ||
3634 | new_dentry = user_path_create(newdfd, newname, &new_path, 0); | 3634 | new_dentry = user_path_create(newdfd, newname, &new_path, |
3635 | (how & LOOKUP_REVAL)); | ||
3635 | error = PTR_ERR(new_dentry); | 3636 | error = PTR_ERR(new_dentry); |
3636 | if (IS_ERR(new_dentry)) | 3637 | if (IS_ERR(new_dentry)) |
3637 | goto out; | 3638 | goto out; |
@@ -3648,6 +3649,10 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, | |||
3648 | error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry); | 3649 | error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry); |
3649 | out_dput: | 3650 | out_dput: |
3650 | done_path_create(&new_path, new_dentry); | 3651 | done_path_create(&new_path, new_dentry); |
3652 | if (retry_estale(error, how)) { | ||
3653 | how |= LOOKUP_REVAL; | ||
3654 | goto retry; | ||
3655 | } | ||
3651 | out: | 3656 | out: |
3652 | path_put(&old_path); | 3657 | path_put(&old_path); |
3653 | 3658 | ||