From: Jeff Layton Date: Thu, 20 Dec 2012 21:15:38 +0000 (-0500) Subject: vfs: fix linkat to retry once on ESTALE errors X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=442e31ca5a49e398351b2954b51f578353fdf210;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git vfs: fix linkat to retry once on ESTALE errors Signed-off-by: Jeff Layton Signed-off-by: Al Viro --- 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);