From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: linux-nfs-owner@vger.kernel.org Received: from mail-gh0-f174.google.com ([209.85.160.174]:35347 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756189Ab2J0Me3 (ORCPT ); Sat, 27 Oct 2012 08:34:29 -0400 Received: by mail-gh0-f174.google.com with SMTP id g15so699691ghb.19 for ; Sat, 27 Oct 2012 05:34:29 -0700 (PDT) From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, michael.brantley@deshaw.com, hch@infradead.org, miklos@szeredi.hu, pstaubach@exagrid.com Subject: [PATCH v8 22/32] vfs: allow lsetxattr() to retry once on ESTALE errors Date: Sat, 27 Oct 2012 08:33:29 -0400 Message-Id: <1351341219-17837-23-git-send-email-jlayton@redhat.com> In-Reply-To: <1351341219-17837-1-git-send-email-jlayton@redhat.com> References: <1351341219-17837-1-git-send-email-jlayton@redhat.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: Signed-off-by: Jeff Layton --- fs/xattr.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/xattr.c b/fs/xattr.c index 5b6e48d..5a9ddba 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -394,16 +394,21 @@ SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname, { struct path path; int error; + unsigned int try = 0; + unsigned int lookup_flags = 0; - error = user_lpath(pathname, &path); - if (error) - return error; - error = mnt_want_write(path.mnt); - if (!error) { - error = setxattr(path.dentry, name, value, size, flags); - mnt_drop_write(path.mnt); - } - path_put(&path); + do { + error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); + if (error) + break; + error = mnt_want_write(path.mnt); + if (!error) { + error = setxattr(path.dentry, name, value, size, flags); + mnt_drop_write(path.mnt); + } + path_put(&path); + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); return error; } -- 1.7.11.7