From patchwork Sat Oct 27 12:33: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: 1655471 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 0D620DFAC4 for ; Sat, 27 Oct 2012 12:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755087Ab2J0MeK (ORCPT ); Sat, 27 Oct 2012 08:34:10 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:59451 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755004Ab2J0MeH (ORCPT ); Sat, 27 Oct 2012 08:34:07 -0400 Received: by mail-gg0-f174.google.com with SMTP id k5so690906ggd.19 for ; Sat, 27 Oct 2012 05:34:06 -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=IMn0pMxpEuyKA2BSacf9ZwTPqowRrgNJXG02MafZgHg=; b=OuoT9ouXR5HObCDpLUL9lGN5NUfBPV0z8Ufs4ExZsplq6frydcKxVITek19dkBhxCz XXTzE74QnGDwFxVZbZ989AYFXUXM9uR9jR61HFJRg62R5ZjfhTaHw3ShrSiRG3a/8akA XRs4BcvUf7tNSO4g8Pp7zvPREfIEBrTT9vcfELesb13Yoe3fIAjFic1ju3UWXn2Ye9ID 55j5oEzfK5ynz4bsYfJIZUe/C/bNAs7fPZu1qOGSPffMP1USF0bjCvY+QtDSj46YLERh UTidXbTswFIsxgIN3viC4KEYvZc2drF9kDmBC4VTtoCzCamRUHWucJfqQdEGJvlQFyUl GTCA== Received: by 10.236.118.229 with SMTP id l65mr16274751yhh.3.1351341246728; Sat, 27 Oct 2012 05:34:06 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id f15sm4124613yhi.11.2012.10.27.05.34.03 (version=SSLv3 cipher=OTHER); Sat, 27 Oct 2012 05:34:05 -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 v8 09/32] vfs: add a reval argument to user_path_parent Date: Sat, 27 Oct 2012 08:33:16 -0400 Message-Id: <1351341219-17837-10-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351341219-17837-1-git-send-email-jlayton@redhat.com> References: <1351341219-17837-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQktBuS1FJlIQfgXDkPSgrTTaLIjSvJ7NlKJunwfb8ziK0tlmcQVuiRPEeV4J0Qjn+VHpwsD 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 d542a19..47b6016 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2184,15 +2184,20 @@ int user_path_at(int dfd, const char __user *name, unsigned flags, * path-walking is complete. */ static struct filename * -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 filename *s = getname(path); int error; + unsigned int flags = LOOKUP_PARENT; + + if (reval) + flags |= LOOKUP_REVAL; if (IS_ERR(s)) return s; - error = filename_lookup(dfd, s, LOOKUP_PARENT, nd); + error = filename_lookup(dfd, s, flags, nd); if (error) { putname(s); return ERR_PTR(error); @@ -3340,7 +3345,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); @@ -3436,7 +3441,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); @@ -3831,13 +3836,13 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname, struct filename *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;