From patchwork Fri Sep 7 14:18:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1423011 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0FE9A3FC85 for ; Fri, 7 Sep 2012 14:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760699Ab2IGOSx (ORCPT ); Fri, 7 Sep 2012 10:18:53 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:42964 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760245Ab2IGOSi (ORCPT ); Fri, 7 Sep 2012 10:18:38 -0400 Received: by ggdk6 with SMTP id k6so539854ggd.19 for ; Fri, 07 Sep 2012 07:18:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=oVnrVsZ5M4KqGi5NeXNkMu1O/pXvON1rkmyIofEJIeY=; b=gmN1wyH8Uo7f7uDAufdAZ4GcAVGJn5up9t1qpxhSNiqpHlonAkhHX+Q30K9EaGVeB3 iFku/a5NtaQh1/3xG5bOZ4JArpYtrCE1UKCCrNSIwaQOTWNVzK+/k/DoP2onoxOkIH7N uxLRvSquHDOxLSpB6IHmInhA8nyqPiAY1HxfUDB7fmUX8k3ys2WgxRri9zESSEPFolui 3HR7xRDj9F7OevSQ2NhPVu0FQqOXNAAiYjMxZRpWKdQiM6+/+C73CLkTtyA9omQgZG6v dJDXRjpnLG4N+qmHXoY/jra+szS+Zo0bt60RXhEKvta5L1kxCFzU0nmoKRkTWgMqRz9F oUBw== Received: by 10.59.1.162 with SMTP id bh2mr8160080ved.13.1347027518213; Fri, 07 Sep 2012 07:18:38 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-069-134-145-027.nc.res.rr.com. [69.134.145.27]) by mx.google.com with ESMTPS id v9sm3207113ves.8.2012.09.07.07.18.36 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 07:18:37 -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 v6 02/20] vfs: make fstatat retry on ESTALE errors from getattr call Date: Fri, 7 Sep 2012 10:18:09 -0400 Message-Id: <1347027507-20956-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347027507-20956-1-git-send-email-jlayton@redhat.com> References: <1347027507-20956-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQnX1oLS6swGQGMt5h8+vWxZUBYqEYWzMGmGHt+7skKzkXFuLKIR8ygcFIiDL4KMWQmXBV9D Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Jeff Layton --- fs/stat.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index b6ff118..d90258d 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -74,7 +74,8 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, { struct path path; int error = -EINVAL; - int lookup_flags = 0; + unsigned int try = 0; + unsigned int lookup_flags = 0; if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH)) != 0) @@ -85,12 +86,15 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, if (flag & AT_EMPTY_PATH) lookup_flags |= LOOKUP_EMPTY; - error = user_path_at(dfd, filename, lookup_flags, &path); - if (error) - goto out; + do { + error = user_path_at(dfd, filename, lookup_flags, &path); + if (error) + break; - error = vfs_getattr(path.mnt, path.dentry, stat); - path_put(&path); + error = vfs_getattr(path.mnt, path.dentry, stat); + path_put(&path); + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); out: return error; }