From patchwork Fri Sep 7 14:18:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1422841 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 C4C1EDF283 for ; Fri, 7 Sep 2012 14:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760738Ab2IGOTA (ORCPT ); Fri, 7 Sep 2012 10:19:00 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:42964 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760669Ab2IGOSp (ORCPT ); Fri, 7 Sep 2012 10:18:45 -0400 Received: by mail-gg0-f174.google.com with SMTP id k6so539854ggd.19 for ; Fri, 07 Sep 2012 07:18:44 -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=PDeW+mofW3BnG8F02WbohUHacw5mma9DA1OTaST8bW8=; b=PbyuyiTfvlU3UYCpTq376OhUQNkb6wRKSisQdrtHviCH6fUuMPBdn6p84G0OnDBtPb eAj/aaWRvrtuw8EE7moXn/8NqLxtDqELf5C1//mO5IEDtwDasEvFRSkVyb4Xy3YxESf2 Bbfjokf42/HxppRDGUtOugbSMI1hp+n+aWOyGfB+HvNUKd7tO3r0ijycwIhpcdYfQJ4S EEh5GB04BFw2WEfBntDkGrujyqWpC9nmpMq8P/knbDH5bkM2t4WfeMJsVhezj2h/9IEJ pc1ZYy603SpDVRYV/RKuwFVpaySn+ne+ZbQrEFJ5uaQgyL+19q8vVmq0oYxSMiRc2Fn7 a3tQ== Received: by 10.221.1.208 with SMTP id nr16mr7325288vcb.20.1347027524733; Fri, 07 Sep 2012 07:18:44 -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 v9sm3207113ves.8.2012.09.07.07.18.43 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 07:18:43 -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 v6 06/20] vfs: fix mkdir to retry on ESTALE errors Date: Fri, 7 Sep 2012 10:18:13 -0400 Message-Id: <1347027507-20956-7-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347027507-20956-1-git-send-email-jlayton@redhat.com> References: <1347027507-20956-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQkeLWBzCJZJk/cct5FPeojpWMyyqHMK2kEiWT+tFaPOwgNjUKHyx/rAGpwXZ6UA1Goa0ead 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 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 11fc388..9068375 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3249,17 +3249,20 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) struct dentry *dentry; struct path path; int error; + unsigned int try = 0; - dentry = user_path_create(dfd, pathname, &path, true, false); - if (IS_ERR(dentry)) - return PTR_ERR(dentry); + do { + dentry = user_path_create(dfd, pathname, &path, true, false); + if (IS_ERR(dentry)) + return PTR_ERR(dentry); - if (!IS_POSIXACL(path.dentry->d_inode)) - mode &= ~current_umask(); - error = security_path_mkdir(&path, dentry, mode); - if (!error) - error = vfs_mkdir(path.dentry->d_inode, dentry, mode); - done_path_create(&path, dentry); + if (!IS_POSIXACL(path.dentry->d_inode)) + mode &= ~current_umask(); + error = security_path_mkdir(&path, dentry, mode); + if (!error) + error = vfs_mkdir(path.dentry->d_inode, dentry, mode); + done_path_create(&path, dentry); + } while (retry_estale(error, try++)); return error; }