From patchwork Fri Jun 29 18:57:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1133161 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 B097DDFF34 for ; Fri, 29 Jun 2012 18:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932779Ab2F2S6a (ORCPT ); Fri, 29 Jun 2012 14:58:30 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:45325 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932763Ab2F2S60 (ORCPT ); Fri, 29 Jun 2012 14:58:26 -0400 Received: by mail-gg0-f174.google.com with SMTP id u4so3043977ggl.19 for ; Fri, 29 Jun 2012 11:58:26 -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=H1ZGkQ3/t57nH+kQ55C5uAnxlxP7uHMj22kTp1RNizY=; b=TnbZClBLRFZXKnFpRAgXzH0iRl4mDrPLWgr3k7lgOZuGonXeNJEMZnR0Q4X90xGVp/ vgsJT+MTnAKtMBcmsLZq0VdK3vwuwEO2afqfBwPRLe2AaPybbAz1DUfog/eF3ivnYAQ7 KrkQOqITzbX2VIA8QiiMo5YQLmiCcxilQ1hm5VBuaQEa099Yv3jWQPPPJc2NO4Rs74WL s3HK1mTxMej5EijoJEjy0F5dGvIYBgRduwlbpbsBwgesaZuc9Z5mhAKTlGYHG7S4WjxY a/ZZ03CqoxpBJgweSNQCtAN7H8vAjmZDXu9deJQgdb2Xlc6n3pGIqml0JFxsH7D2pETh 9Atw== Received: by 10.236.193.101 with SMTP id j65mr4539159yhn.74.1340996305877; Fri, 29 Jun 2012 11:58:25 -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.24 (version=SSLv3 cipher=OTHER); Fri, 29 Jun 2012 11:58:25 -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 13/17] vfs: make do_unlinkat retry on ESTALE errors Date: Fri, 29 Jun 2012 14:57:56 -0400 Message-Id: <1340996280-27123-14-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: ALoCoQkPeJs33USlmxQnpBCn1dMqvzJlgjLjKciiG0+TtjEO/KnfKYaMLJyWpGxupDGvNke78f+l 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/namei.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 7fccc1c..7fadc99 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2955,8 +2955,14 @@ static long do_unlinkat(int dfd, const char __user *pathname) struct dentry *dentry; struct nameidata nd; struct inode *inode = NULL; + unsigned int try = 0; + unsigned int lookup_flags = LOOKUP_PARENT; - error = user_path_parent(dfd, pathname, &nd, &name); + name = getname(pathname); + if (IS_ERR(name)) + return PTR_ERR(name); +retry: + error = do_path_lookup(dfd, name, lookup_flags, &nd); if (error) return error; @@ -2994,6 +3000,10 @@ exit3: iput(inode); /* truncate the inode here */ exit1: path_put(&nd.path); + if (retry_estale(error, try++)) { + lookup_flags |= LOOKUP_REVAL; + goto retry; + } putname(name); return error;