From patchwork Wed Aug 8 13:21:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1295471 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 0C800DF223 for ; Wed, 8 Aug 2012 13:22:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758440Ab2HHNV4 (ORCPT ); Wed, 8 Aug 2012 09:21:56 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:63871 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758418Ab2HHNVx (ORCPT ); Wed, 8 Aug 2012 09:21:53 -0400 Received: by mail-gh0-f174.google.com with SMTP id r11so730361ghr.19 for ; Wed, 08 Aug 2012 06:21:53 -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=OEzgfhKr75Q8DXD+6sdNT3n7eplkRZBtcwyuuQ9J+VI=; b=A/sWMlOh+Q0XK5FjlZWIEpBPXBAXTHgatIwvxAhxJ00EK9NJGXkicQfpm1n3PlDSgM kYkhD7vDpCsF2VkWrEo/Wlm86zgQlOB8dqbLZpoDYOI2hxzC1daHg4alxz0ZXg12cjpf JNuuTxhG9BJg5qCFWMTwUdVFydeJAEi6vD6ocyWiiEtxSh0y22Ygxs0ibQYrRfe4AqcS hsftXtAo1VT5SEntZDe23fZ/1HAFQkuRekh768Ly9vM1VdoHc0ZDxLMqAoXceSi0q6Xu bnYbNGZMH8GSF0nz1rSywlPEHdLXjUZveWNuJdLU1BVNkG404v5dURduRLNz/xzxAno7 hCMA== Received: by 10.236.177.42 with SMTP id c30mr16581145yhm.37.1344432113141; Wed, 08 Aug 2012 06:21:53 -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 l1sm24418002yhm.19.2012.08.08.06.21.51 (version=SSLv3 cipher=OTHER); Wed, 08 Aug 2012 06:21:52 -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 v5 04/19] vfs: fix readlinkat to retry on ESTALE Date: Wed, 8 Aug 2012 09:21:27 -0400 Message-Id: <1344432102-22312-5-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1344432102-22312-1-git-send-email-jlayton@redhat.com> References: <1344432102-22312-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQl6+UzRl09GYNLVE0tRO3wYqroqW2/z1rou+sakxym+1aWa79diKZYRb8T67EZWpJKczTU9 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 file 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; }