From patchwork Sat Oct 27 12:33: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: 1655571 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D3F7DDFAC4 for ; Sat, 27 Oct 2012 12:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754396Ab2J0Md4 (ORCPT ); Sat, 27 Oct 2012 08:33:56 -0400 Received: from mail-ye0-f174.google.com ([209.85.213.174]:56913 "EHLO mail-ye0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753686Ab2J0Mdx (ORCPT ); Sat, 27 Oct 2012 08:33:53 -0400 Received: by mail-ye0-f174.google.com with SMTP id m12so638325yen.19 for ; Sat, 27 Oct 2012 05:33:52 -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=1cI11iYCdIomizgK147JMP+71c0Y92wxye4C6HQpTas=; b=VEoJHTVh6zRAi4HxKRmlnyvy7O6k9aL46z3pxzzdLemSm9lWMycQuqBaulJZklUQie itW9AZPdERvnlSOsc071cFJuwQCe0NHXTmKzR8i8PoGlRvn76fDt2LHriQnac2IlkmSG wLoVTDrt8H97pfd0IsgunejM+YPMR8oQU/nmqQ9LBVUwB4w114sKJY7Jgnd6EhbKFG7y OcVLHXV1g055ftFkFcHgwarMJCBmhUwUkBTaK/T1o4rrfbbGLqccNHC73cvrucN5dQw0 RNK8PF4EQHeKG21xCu3PQIiOs9k4LumOnhcUxIAXn+WJXrdqL/cYWd5ohYiUDZdJP4nk aJXA== Received: by 10.236.155.71 with SMTP id i47mr25220437yhk.72.1351341232803; Sat, 27 Oct 2012 05:33:52 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id f15sm4124613yhi.11.2012.10.27.05.33.50 (version=SSLv3 cipher=OTHER); Sat, 27 Oct 2012 05:33:51 -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 02/32] vfs: make fstatat retry on ESTALE errors from getattr call Date: Sat, 27 Oct 2012 08:33:09 -0400 Message-Id: <1351341219-17837-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351341219-17837-1-git-send-email-jlayton@redhat.com> References: <1351341219-17837-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQlaSSxHhCPCHdcH0bDUMiJlu9MUTNtLzQgj2JZ+/cJdN9qw0FuAV3QGU7L/zLCAteAnY9r7 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 eae4946..c97a17e 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; }