From patchwork Fri Sep 7 14:18:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1422731 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 31249DF283 for ; Fri, 7 Sep 2012 14:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760667Ab2IGOUg (ORCPT ); Fri, 7 Sep 2012 10:20:36 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:42139 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760797Ab2IGOTI (ORCPT ); Fri, 7 Sep 2012 10:19:08 -0400 Received: by mail-vb0-f46.google.com with SMTP id ff1so3363913vbb.19 for ; Fri, 07 Sep 2012 07:19:08 -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=S6bjHfWn0Xugp9m9j6AldFUClwnPUrEeYPbw0xQDliU=; b=oHZj6vFsBkV2tvU6dn58+VFHRwjx6tJaJ9+OpBfCKCRaMvGbnYgpUPCjetmD7djIl6 M59xJR5dmFO1MjFp5UNd7jmFWcpWy9RmUAUIh/ycgez4v2elFmc323Hy1ShI0PYTfVP2 GEaplpZ8jlQVbP1wlLCYPeXWm+hxg/JYm8oISiT5z1LNZWYxDLugplXTQTc/xwB8lZf2 K3rxvmT0b4iCOx+T+AT3Qb+DyGRC+UbXXsCwBUSiFoERb+DR5BsU4sNefwiUacPKi1+1 1a9QAd9sWgeYQ6K9KSsYy8UjibTM7E9NYRIGAw3WaLQxKyNyZRmVRtcQ8wIKMLdUJWGL Lw/w== Received: by 10.52.68.110 with SMTP id v14mr5934232vdt.14.1347027529765; Fri, 07 Sep 2012 07:18:49 -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.48 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 07:18:48 -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 09/20] vfs: add a reval argument to user_path_parent Date: Fri, 7 Sep 2012 10:18:16 -0400 Message-Id: <1347027507-20956-10-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: ALoCoQkJe4DcjEjadHDdfDm0kz8tn6FCveBb//Gyq7ChA0hnlYabdx5eivSOaPV1gCi1p5uQQ1GM Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org ...so we can tell it when to set LOOKUP_REVAL. Signed-off-by: Jeff Layton --- fs/namei.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index e05d6ee..51841ec 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2183,15 +2183,20 @@ int user_path_at(int dfd, const char __user *name, unsigned flags, * path-walking is complete. */ static struct getname_info * -user_path_parent(int dfd, const char __user *path, struct nameidata *nd) +user_path_parent(int dfd, const char __user *path, struct nameidata *nd, + unsigned int reval) { struct getname_info *s = getname(path); int error; + unsigned int flags = LOOKUP_PARENT; + + if (reval) + flags |= LOOKUP_REVAL; if (IS_ERR(s)) return s; - error = ginfo_lookup(dfd, s, LOOKUP_PARENT, nd); + error = ginfo_lookup(dfd, s, flags, nd); if (error) { putname(s); return ERR_PTR(error); @@ -3339,7 +3344,7 @@ static long do_rmdir(int dfd, const char __user *pathname) struct dentry *dentry; struct nameidata nd; - name = user_path_parent(dfd, pathname, &nd); + name = user_path_parent(dfd, pathname, &nd, 0); if (IS_ERR(name)) return PTR_ERR(name); @@ -3435,7 +3440,7 @@ static long do_unlinkat(int dfd, const char __user *pathname) struct nameidata nd; struct inode *inode = NULL; - name = user_path_parent(dfd, pathname, &nd); + name = user_path_parent(dfd, pathname, &nd, 0); if (IS_ERR(name)) return PTR_ERR(name); @@ -3830,13 +3835,13 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, struct getname_info *to; int error; - from = user_path_parent(olddfd, oldname, &oldnd); + from = user_path_parent(olddfd, oldname, &oldnd, 0); if (IS_ERR(from)) { error = PTR_ERR(from); goto exit; } - to = user_path_parent(newdfd, newname, &newnd); + to = user_path_parent(newdfd, newname, &newnd, 0); if (IS_ERR(to)) { error = PTR_ERR(to); goto exit1;