From patchwork Mon Nov 5 15:21:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1699181 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 6A510DF2AB for ; Mon, 5 Nov 2012 15:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932760Ab2KEPgc (ORCPT ); Mon, 5 Nov 2012 10:36:32 -0500 Received: from mail-ye0-f174.google.com ([209.85.213.174]:52182 "EHLO mail-ye0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932606Ab2KEPW0 (ORCPT ); Mon, 5 Nov 2012 10:22:26 -0500 Received: by mail-ye0-f174.google.com with SMTP id m12so1017184yen.19 for ; Mon, 05 Nov 2012 07:22:26 -0800 (PST) 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=3CBvm5GYmRxP7AIn7M7T7XOR6I86l+Lo/RYyGRoMXss=; b=L4SgV/kzZ4zf50vtasSQf81x/r9ogjNetVmTBqAkhZ0zWMQw4CFz5X3OP6I2Vm87oY Qe/8e60/T76VUdRTt5t/HCw9b3DrjYsOL2B1w4xNvQjKH87+okf67s413AmLG/JPOo5G pjBTrytEPbKTaexvWlafTMlm1T41LOu070cdSHbzRrXaPjZuzReCpJNvSLxaUotUm1we R51+aP2zUDEf3g2+/IHvFqMu+FWvPeAubfFyUGFoKYmFkjvYz8J9Q51j+1Bc2Ujv6Tls R3iKCuT/3IZQ5CrQa33zoGSD/dLz7YXmhh02V8kofKDeCJzCVUd9uhHFJmo89Ej9AJpb zOhg== Received: by 10.236.81.209 with SMTP id m57mr9122306yhe.84.1352128946254; Mon, 05 Nov 2012 07:22:26 -0800 (PST) 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 y18sm12026769anh.15.2012.11.05.07.22.24 (version=SSLv3 cipher=OTHER); Mon, 05 Nov 2012 07:22:25 -0800 (PST) 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 v9 03/34] vfs: fix readlinkat to retry on ESTALE Date: Mon, 5 Nov 2012 10:21:42 -0500 Message-Id: <1352128933-28526-4-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1352128933-28526-1-git-send-email-jlayton@redhat.com> References: <1352128933-28526-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQkbN57ObUK2Bwptf+47slodcmrDgDQ/0xyd9Tg9rethGr+fkclR30eBsYg2GCln7Afg5c2x 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, 12 insertions(+), 4 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index c97a17e..452ee93 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -300,14 +300,21 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, struct path path; int error; int empty = 0; + 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; + do { + struct inode *inode; + + error = user_path_at_empty(dfd, pathname, lookup_flags, + &path, &empty); + if (error) + break; + inode = path.dentry->d_inode; error = empty ? -ENOENT : -EINVAL; if (inode->i_op->readlink) { error = security_inode_readlink(path.dentry); @@ -318,7 +325,8 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, } } path_put(&path); - } + lookup_flags |= LOOKUP_REVAL; + } while (retry_estale(error, try++)); return error; }