Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp872433ybv; Sat, 22 Feb 2020 17:20:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxaZCOZq/fV+wqpleHqQ5/4ytaKbK8MZIFtQ3gGqE48e7ogbAs/jPCAafHEt0wYi8NV7MN6 X-Received: by 2002:a9d:3e43:: with SMTP id h3mr33151668otg.84.1582420835536; Sat, 22 Feb 2020 17:20:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582420835; cv=none; d=google.com; s=arc-20160816; b=gVrVRlQ2sCl4nduL98OczD7JSh2yaeUQN4vwgP+0E/0vRHpl3Y5ji1aGY7yo8fP0kq aVBAt7UzbZ7S2w2xCOPRC7XFLAZArZtF6nN41giX5h62C7Y60eynOPkjNWk9GpHV49Ms DU3kEqThbdpCcJC1jZY716T1Deqiolj4aD9fU7dqnHidXjdMs8uhWqPXdg4UZlsKRMt5 Ue8dZr8RjU0k5C6ZxFuGxgJQMXObueFLi93dvCRrOU8xIWZ4CCJqd2Gl+CfrWY9EbqJF svqWr4BmsmCSJ14kHHPAdf4nONcHEUMddnI638MLjHQzRrFtxEcrK2QxAU+oVANb2fM7 i0HQ== 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=1uFBlSBFIZH6kMWaHb6KCbiDGF/ZEyu9dEJiF1UWr0A=; b=vZPWrDR40PP54vu8sQKYEba1UUDJ9WcOXK+l5OZWYot+G/5gcXx6bwFeJLwiRKRSq4 qA93uxurDz3sVDBtZVOzc5RYmDQONVRqY52x5tIpp0XXAyJTPfEdwYjEUqew2mVQftta 0k5ICL+OPMwGKLfbGfmWiYg0pjvh7segtNwYEnSrEXz91nXGNSjAb9uj7kCCBf6US8BB fh1cpMhZ+bhit0kGtz8B8+XJHmHedYMXiRSrtyRkAloJSYGuAVywkcLOBGz8uFjmG0V3 LcfWr+Uo/BUoZWJN0d0tBlktcNdqEBqtnTjk5XvNdvqzOq77BlA/K/oNLZaWuM4xpKem IbRw== 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 j143si3364735oib.16.2020.02.22.17.20.23; Sat, 22 Feb 2020 17:20:35 -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 S1727239AbgBWBUQ (ORCPT + 99 others); Sat, 22 Feb 2020 20:20:16 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:50156 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbgBWBUQ (ORCPT ); Sat, 22 Feb 2020 20:20:16 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5fw7-00HDfE-JU; Sun, 23 Feb 2020 01:20:04 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Linus Torvalds Subject: [RFC][PATCH v2 14/34] new step_into() flag: WALK_NOFOLLOW Date: Sun, 23 Feb 2020 01:16:06 +0000 Message-Id: <20200223011626.4103706-14-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 Tells step_into() not to follow symlinks, regardless of LOOKUP_FOLLOW. Allows to switch handle_lookup_down() to of step_into(), getting all follow_managed() and step_into() calls paired. Signed-off-by: Al Viro --- fs/namei.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 4c9b633e1981..fe48a8d00ae5 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1827,7 +1827,7 @@ static int pick_link(struct nameidata *nd, struct path *link, return 1; } -enum {WALK_FOLLOW = 1, WALK_MORE = 2}; +enum {WALK_FOLLOW = 1, WALK_MORE = 2, WALK_NOFOLLOW = 4}; /* * Do we need to follow links? We _really_ want to be able @@ -1841,7 +1841,8 @@ static inline int step_into(struct nameidata *nd, struct path *path, if (!(flags & WALK_MORE) && nd->depth) put_link(nd); if (likely(!d_is_symlink(path->dentry)) || - !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW)) { + !(flags & WALK_FOLLOW || nd->flags & LOOKUP_FOLLOW) || + flags & WALK_NOFOLLOW) { /* not a symlink or should not follow */ path_to_nameidata(path, nd); nd->inode = inode; @@ -2363,10 +2364,7 @@ static int handle_lookup_down(struct nameidata *nd) err = handle_mounts(nd, nd->path.dentry, &path, &inode, &seq); if (unlikely(err < 0)) return err; - path_to_nameidata(&path, nd); - nd->inode = inode; - nd->seq = seq; - return 0; + return step_into(nd, &path, WALK_NOFOLLOW, inode, seq); } /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ -- 2.11.0