From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: [PATCH v7 44/49] vfs: make getxattr retry once on an ESTALE error Date: Mon, 1 Oct 2012 20:16:53 -0400 Message-ID: <1349137018-21948-45-git-send-email-jlayton@redhat.com> References: <1349137018-21948-1-git-send-email-jlayton@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org To: viro@ZenIV.linux.org.uk Return-path: In-Reply-To: <1349137018-21948-1-git-send-email-jlayton@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com List-Id: linux-fsdevel.vger.kernel.org Signed-off-by: Jeff Layton --- fs/xattr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/xattr.c b/fs/xattr.c index d981635..1775213 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -479,12 +479,17 @@ SYSCALL_DEFINE4(getxattr, const char __user *, pathname, { struct path path; ssize_t error; + unsigned int try = 0; + unsigned int lookup_flags = LOOKUP_FOLLOW; - error = user_path(pathname, &path); - if (error) - return error; - error = getxattr(path.dentry, name, value, size); - path_put(&path); + do { + error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); + if (error) + break; + error = getxattr(path.dentry, name, value, size); + path_put(&path); + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); return error; } -- 1.7.11.4