Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1124066ybl; Sat, 18 Jan 2020 19:22:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwOBQaOlG/OX+yJQRCbjUP4mH3IW0xEXRrT8rS9weNn/J6z2juJVspZba341YGfaP6tjnyj X-Received: by 2002:a9d:2965:: with SMTP id d92mr10873488otb.175.1579404125673; Sat, 18 Jan 2020 19:22:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579404125; cv=none; d=google.com; s=arc-20160816; b=Rk16Bv6FDkADtvYza+Cu/Vzguzgu0ThdroZJJdK95Dcb949ADaPJngnhI5zb08AtWn SOPNUBzZAMtpTgCa6mNbNYZnzmDTheEeI/BL+nFf5vprX71Ogeb58SwQEJp/n6PGeVJ2 /edeESJNJapIAjVgWu2/k7YVnRFPCDDF0t7DbwCG6eQgjAb8K/AbhR1BxdET9R+dFWM3 zgpgO9Nj7mfHnbmQdkrR7NAj1r+WHZvwHmsF0yl29TzxJVbc8Hmm44H6pU+oY62sFhv9 yxTB8MNJoLIpG3Xh5j1ZTlvr5B0m7RDGG1l44LxPJXWs2/FNfI31Qexy70Fz4XtXZf55 d0xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TJJP4JUwsca0sNKvw/8lVz0vqj3jg9to5vLdkhtIN28=; b=d6spM2aQaJ/MBEkmDh63vVK9AoaUNTJmYKZkFfhCZP+zew0vIF2tfY9PgSYXuf4b5o dd3Vml5u5zyZtuPnZEzzVexbzAW1RvyKyqnAX0RqWoxMLnQCwOfZoZPUiSbQnDvqjJDm u3R2dJZG314hxwGu3c1eJ7dm2FNmuTXO8U/u55KXtQ5FUUv2Haxv07WM9uhjfwNWYht3 Pwbs6r3utbXBpVn2GEJqZ43umHHNUiYCHUI+/KVmrs/T3K1O9+YNKeVrbBwK06Ear8GT swUkqKdttHsf23gttt/IXzd3giziaMgSMc3IlPvQ8wfawM26IRn5zq0mB0PcjTLXT17i lVVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si17825608otq.317.2020.01.18.19.21.53; Sat, 18 Jan 2020 19:22:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728587AbgASDUp (ORCPT + 99 others); Sat, 18 Jan 2020 22:20:45 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:56770 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbgASDUp (ORCPT ); Sat, 18 Jan 2020 22:20:45 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1it18B-00BFZ1-Ek; Sun, 19 Jan 2020 03:20:15 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Aleksa Sarai , David Howells , Eric Biederman , Christian Brauner , Al Viro Subject: [PATCH 09/17] do_last(): collapse the call of path_to_nameidata() Date: Sun, 19 Jan 2020 03:17:21 +0000 Message-Id: <20200119031738.2681033-9-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> References: <20200119031423.GV8904@ZenIV.linux.org.uk> <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro ... and shift filling struct path to just before the call of handle_mounts(). All callers of handle_mounts() are immediately preceded by path->mnt = nd->path.mnt now. Signed-off-by: Al Viro --- fs/namei.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 30503f114142..f66553ef436a 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3230,8 +3230,6 @@ static int do_last(struct nameidata *nd, error = PTR_ERR(dentry); goto out; } - path.mnt = nd->path.mnt; - path.dentry = dentry; if (file->f_mode & FMODE_OPENED) { if ((file->f_mode & FMODE_CREATED) || @@ -3247,7 +3245,8 @@ static int do_last(struct nameidata *nd, open_flag &= ~O_TRUNC; will_truncate = false; acc_mode = 0; - path_to_nameidata(&path, nd); + dput(nd->path.dentry); + nd->path.dentry = dentry; goto finish_open_created; } @@ -3261,6 +3260,8 @@ static int do_last(struct nameidata *nd, got_write = false; } + path.mnt = nd->path.mnt; + path.dentry = dentry; error = handle_mounts(&path, nd, &inode, &seq); if (unlikely(error < 0)) return error; -- 2.20.1