From patchwork Fri Jun 29 18:57:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1133381 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 074B4DFF34 for ; Fri, 29 Jun 2012 19:03:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756026Ab2F2TCr (ORCPT ); Fri, 29 Jun 2012 15:02:47 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:50231 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932625Ab2F2S6O (ORCPT ); Fri, 29 Jun 2012 14:58:14 -0400 Received: by yenl2 with SMTP id l2so3038206yen.19 for ; Fri, 29 Jun 2012 11:58:13 -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=hye9S2CszJfTG6adY4nsQHrHaIctSbJsOJugLhyO72s=; b=A1HdbAfWATi7Ni8chjZZ2rg6z/BjIUEYhMBg1F+6wVCeyfphwjG42Q+z22rAknORZY JCsTkkWAhmPDoA/SvZZXlE+gq7gK0PJBEkWOnTj0fLdifYxSvVJCH3r17/7n3U2n4Qmk T3FRBB56+CaBndNztt602U+P5LlHHI8CTE65hfgwWspo9b0S6XOMsMA4IECtU56jhbox Pw42sDPVY54xclsR1XZuSKkhXfHKVZTiBV/crLqg/ihA/aYkx/aQPZzm511P+FBEuz0E m488ketLzuPGN1ee4lSecyQoLpZjdESlTjqPwUG/Rayv+T6qAa0FI5TWwovL4NEJpKrB qoVQ== Received: by 10.101.152.6 with SMTP id e6mr1231285ano.17.1340996293567; Fri, 29 Jun 2012 11:58:13 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-076-182-054-194.nc.res.rr.com. [76.182.54.194]) by mx.google.com with ESMTPS id l13sm3936309ann.2.2012.06.29.11.58.11 (version=SSLv3 cipher=OTHER); Fri, 29 Jun 2012 11:58:12 -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 v3 04/17] vfs: fix readlinkat to retry on ESTALE Date: Fri, 29 Jun 2012 14:57:47 -0400 Message-Id: <1340996280-27123-5-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1340996280-27123-1-git-send-email-jlayton@redhat.com> References: <1340996280-27123-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQkFgMuFZ8+Jk6EJzBC5sZlVCu7F8PD6zmVYWXnYj+VDjzrsyGAbwGZsaswY3QnqFDlVvvMs 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 | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index 5afeb37..c9d88f7 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -307,14 +307,25 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, struct path path; int error; int empty = 0; + char *name; + unsigned int try = 0; + unsigned int lookup_flags = LOOKUP_EMPTY; if (bufsiz <= 0) return -EINVAL; - error = user_path_at_empty(dfd, pathname, LOOKUP_EMPTY, &path, &empty); - if (!error) { - struct inode *inode = path.dentry->d_inode; + name = getname_flags(pathname, lookup_flags, &empty); + if (IS_ERR(name)) + return PTR_ERR(name); + + do { + struct inode *inode; + + error = kern_path_at(dfd, name, lookup_flags, &path); + if (error) + break; + inode = path.dentry->d_inode; error = empty ? -ENOENT : -EINVAL; if (inode->i_op->readlink) { error = security_inode_readlink(path.dentry); @@ -325,7 +336,9 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, } } path_put(&path); - } + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); + putname(name); return error; }