From patchwork Fri Sep 7 14:18:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1422641 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 0CE03E00B1 for ; Fri, 7 Sep 2012 14:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760757Ab2IGOTD (ORCPT ); Fri, 7 Sep 2012 10:19:03 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:38547 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760689Ab2IGOSs (ORCPT ); Fri, 7 Sep 2012 10:18:48 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so3363795vbb.19 for ; Fri, 07 Sep 2012 07:18:47 -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=8xfSeKn9EJs/AMmbajmsGJedCNBOu+uE2Z1uF/Te6Xc=; b=kP18BuUNklBu6FJ9EBuRkRO9ute5V3+dbXBzU23eJ33AtZa1FJDdsHEiLsP0bsGyOC I0099F1oTEuMVeT6Avswpj6sJIa+2fHB7jZgDnOyYss8hkYGXVUs+m9T9Yy+RoNvW2jy UGUU4Dm957DAorLUcmr0W9jpNQuOcQOR1qksubRL6rk/EKIO6Elw/OzSZkoS/DYzIC61 3laVdbbrZfv4nNb9DgjwC8yECyfklaXb7TBFw+Ib8XY/rO9lr1uJA1iOBb7Pp8YlKrnl mVLSds1JdzbuSu9bZwV4dNzzvZOwH03dDNNzbWmDyucA1xW6az8hmPygPXEL7iGpPbCh M5gg== Received: by 10.220.223.202 with SMTP id il10mr7354502vcb.2.1347027526330; Fri, 07 Sep 2012 07:18:46 -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.44 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 07:18:45 -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 07/20] vfs: fix symlinkat to retry on ESTALE errors Date: Fri, 7 Sep 2012 10:18:14 -0400 Message-Id: <1347027507-20956-8-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: ALoCoQmA35Rou+sBQpPdpJ6bE0ynXDYHehcVQO/g4jPAc2gR9DyCpfYDr25l6zYwpNogjj24g1Er 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 | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 9068375..ac731fc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3524,21 +3524,25 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, struct getname_info *from; struct dentry *dentry; struct path path; + unsigned int try = 0; from = getname(oldname); if (IS_ERR(from)) return PTR_ERR(from); - dentry = user_path_create(newdfd, newname, &path, false, false); - error = PTR_ERR(dentry); - if (IS_ERR(dentry)) - goto out_putname; + do { + dentry = user_path_create(newdfd, newname, &path, false, false); + if (IS_ERR(dentry)) { + error = PTR_ERR(dentry); + break; + } - error = security_path_symlink(&path, dentry, from->name); - if (!error) - error = vfs_symlink(path.dentry->d_inode, dentry, from->name); - done_path_create(&path, dentry); -out_putname: + error = security_path_symlink(&path, dentry, from->name); + if (!error) + error = vfs_symlink(path.dentry->d_inode, dentry, + from->name); + done_path_create(&path, dentry); + } while (retry_estale(error, try++)); putname(from); return error; }