From patchwork Wed Aug 8 13:21:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1295681 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E7F153FD8D for ; Wed, 8 Aug 2012 13:25:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932652Ab2HHNZX (ORCPT ); Wed, 8 Aug 2012 09:25:23 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:36554 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758464Ab2HHNWC (ORCPT ); Wed, 8 Aug 2012 09:22:02 -0400 Received: by mail-yw0-f46.google.com with SMTP id m54so724654yhm.19 for ; Wed, 08 Aug 2012 06:22:02 -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=8itxrKmhHi3Mr7aVc7aJTVWZUfbAmbEjtf5jrnQUvQc=; b=VitKXpHz+7jee6LY7121QYtjsFHgOAt92hH/bN1ApWU+1WDrD9+yoIfCzc28UWoibA bRX0tz2PpVgX3WlFihmQIe5Q4JwUxAqoXhAU8Jb1kDAR0b4a7IiyLaSfWeEy6CjJjPWz RdRTjU0h1851DBWlGGQXnMKxf2dWU8zUXW6D/RqOmw5LUgyPZFIx/avQ+4Wpa9DcNkrb gNxd3VQo1AbVFhTvTDrvssnzgzWCa/LLmRQKdTgNa3TuOlnjzn7pDXIXuVn5IBSnS7z8 M849EXXQfsI4XkbS/4mBAB0kOtCuF44TzJUfOH3RqWGwXyItrNb6ZHdJjvCBJ433unqn IuiQ== Received: by 10.236.78.3 with SMTP id f3mr16601221yhe.34.1344432121739; Wed, 08 Aug 2012 06:22:01 -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.22.00 (version=SSLv3 cipher=OTHER); Wed, 08 Aug 2012 06:22:01 -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 10/19] vfs: fix symlinkat to retry on ESTALE errors Date: Wed, 8 Aug 2012 09:21:33 -0400 Message-Id: <1344432102-22312-11-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: ALoCoQnf/RTckZGd5hE2ClQXvwC31F0rah7mkD3/8LVl8bBFVQ8p+4SDOwxu4fPNT5j+pXNw9H/7 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 | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 9fd5163..9986117 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3468,24 +3468,34 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, int, newdfd, const char __user *, newname) { int error; - char *from; + char *from, *to; 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, 0); - error = PTR_ERR(dentry); - if (IS_ERR(dentry)) - goto out_putname; + to = getname(newname); + if (IS_ERR(to)) { + putname(from); + return PTR_ERR(to); + } - error = security_path_symlink(&path, dentry, from); - if (!error) - error = vfs_symlink(path.dentry->d_inode, dentry, from); - done_path_create(&path, dentry); -out_putname: + do { + dentry = kern_path_create(newdfd, to, &path, 0, try); + if (IS_ERR(dentry)) { + error = PTR_ERR(dentry); + break; + } + + error = security_path_symlink(&path, dentry, from); + if (!error) + error = vfs_symlink(path.dentry->d_inode, dentry, from); + done_path_create(&path, dentry); + } while (retry_estale(error, try++)); + putname(to); putname(from); return error; }