Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp871349ybv; Sat, 22 Feb 2020 17:19:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzVPzPzTSNev/56sCmStqO/koHcBygyecHZjJ1RncnmuQVDZOvarJEIaMYVWYAwZHpcfzaK X-Received: by 2002:aca:4183:: with SMTP id o125mr7654163oia.125.1582420754043; Sat, 22 Feb 2020 17:19:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582420754; cv=none; d=google.com; s=arc-20160816; b=aW7lC8kshSOpBGhxLnAZXAbL7VkSPnbyWRftv5D7JEnvCu7HzDcnRte0JqWIf8qe72 7E+QHqvcOQozP7prA67MZtRSMM54GCFKF/fz7A79aeyD9Nn5umoYI/VsFqtHTrGDFhRt DziJ130VL9CYu5Z8BLqjTLyFvca717jD6NcTlCNSUxPieiqk8peif0NAH+ASQGPEV1Aq 5TcIEGHLpElS87jeHKwS0EDZ5lqJyRQbh6VusFmp+fmX5WIyrQn7OcdeAb6ZPgv0SnyN BrGXmurzpMsl2GRfnuIeJjq6H6+LcFcVlONfyb7EhvcS+mPmDkEoe9yBBfEGRhUiE2ba hGeA== 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=KT0OPlTH4ZydXke7yAdzj+eP5G/tEs8irV6OFNnwLS8=; b=NUeSnINFjBPmLK/diS+OZP1OOWXmeQkvv4P687gc18lgAe7TR0YwSYaOiVqCnfFVMx fVy/27bAh3e6kuKntmYtgxNpGfK4KQdEr3ALeZNvgqwyWFpJhMrfQIB1f4nrAjj/1MWN aKOjlNPjd/sHvxQUtm8+ESazh6bSEIbt7qIGNT8DgVQT3r0aYrNrJTmRxFHz1KqN+SDs RY0YdBrSyofTLxLP9gIE8GeS904OkAypHDwPzwQ5Pmj1UATXAMvKO25so918QUYTruWp 951O1jJgyj2PbFx19zIHDGUi5Y9+npoeUWeXCUrYaedMHvgsgkc04Pb/V91+UI6TfP9P gcdw== 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 p19si3980785otq.296.2020.02.22.17.19.02; Sat, 22 Feb 2020 17:19:14 -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 S1727213AbgBWBS7 (ORCPT + 99 others); Sat, 22 Feb 2020 20:18:59 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:50126 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbgBWBS7 (ORCPT ); Sat, 22 Feb 2020 20:18:59 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5ful-00HDd4-DO; Sun, 23 Feb 2020 01:18:40 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds Subject: [RFC][PATCH v2 09/34] do_last(): collapse the call of path_to_nameidata() Date: Sun, 23 Feb 2020 01:16:01 +0000 Message-Id: <20200223011626.4103706-9-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200223011626.4103706-1-viro@ZenIV.linux.org.uk> References: <20200223011154.GY23230@ZenIV.linux.org.uk> <20200223011626.4103706-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 4946d006ba20..f26af0559abf 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3364,8 +3364,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) || @@ -3382,7 +3380,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; } @@ -3396,6 +3395,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.11.0