Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2365002imm; Tue, 10 Jul 2018 19:23:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfEwbP97imLK4nLL2EfPizQNomdQGjSOiYMq3gaivM/q/iRlxtdZ1dy294zQ1w0v5EDYbz7 X-Received: by 2002:a63:5421:: with SMTP id i33-v6mr25208114pgb.417.1531275834417; Tue, 10 Jul 2018 19:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531275834; cv=none; d=google.com; s=arc-20160816; b=abLgjcar6rS+FG9ycTIvTMXcTc3fyX5mTdHGcX+ynQNJztgaWKX8j/94DHNgNJxEFg cLMnW6t7bTVma7dHW8i2RPHdtQRisb37+F69GC8e2RW5zLvzoUn+hzPw6enDMsXD+e6O i+X0gWGN/4v8z6b8mWNy5jfbybdcwyUUSRCLRsHeC7J/RGMn111dOvkSEYXo0n8lQ6eK FZQ/yr0JiNQ7SIuw5DltTUHNX7NjwkC+7n8uu211kTEqEysh8i6dYoJRIxAyV/5p4UzS OXJSzXT6DC/g2mCHL163yUOXCBRwdJfzNPLnurhKtFhKLFg6fyNCxrbWa/tYCEhtbly/ 0mOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=sONwjjwTK7+XcP3zCVHMVZUw8DMTA8UlUjPFXAgjyX8=; b=bVaGnRz03Aj7u5wIc0Jv/MkAJiAb2lB1CSF45IWfFHWdSWLWxoA8wP6Y7vm4T8Te4b KF8Klfe5pptyFCCjYmKIIydiknH702VuK4IIkTwE0JY8Hz061N0e9TyX/db5frjUAZAC v2fPUoCu3HNvq8yce4Pywgix3U14eLxDs6qgB0ZR4ND+d0TB3O6eDIVMcraHa6M7mJ6m yfvvnjIxjTxTCkDiA23+l+wDXz1LAdA9tjbhSkwgoZaKeFRfTdm8OwmQT1dHB1P+40fd iME4LHt5IK4WtNbOvIV2kfT9dAJA17cXDpm7X3yJb228zRMSgbS2wg06rjgB4WX6G6F+ 6+9w== 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 m39-v6si18339088plg.371.2018.07.10.19.23.38; Tue, 10 Jul 2018 19:23:54 -0700 (PDT) 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 S1732648AbeGKCYJ (ORCPT + 99 others); Tue, 10 Jul 2018 22:24:09 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45738 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732610AbeGKCYI (ORCPT ); Tue, 10 Jul 2018 22:24:08 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fd4lf-0003MA-Pw; Wed, 11 Jul 2018 02:22:11 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi Subject: [RFC][PATCH 42/42] few more cleanups of link_path_walk() callers Date: Wed, 11 Jul 2018 03:22:06 +0100 Message-Id: <20180711022206.12571-42-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180711022206.12571-1-viro@ZenIV.linux.org.uk> References: <20180711021136.GN30522@ZenIV.linux.org.uk> <20180711022206.12571-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- fs/namei.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index a55da43f169c..f032a30fc8c6 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2269,10 +2269,8 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path if (unlikely(flags & LOOKUP_DOWN) && !IS_ERR(s)) { err = handle_lookup_down(nd); - if (unlikely(err < 0)) { - terminate_walk(nd); - return err; - } + if (unlikely(err < 0)) + s = ERR_PTR(err); } while (!(err = link_path_walk(s, nd)) @@ -3472,7 +3470,6 @@ static int do_o_path(struct nameidata *nd, unsigned flags, struct file *file) static struct file *path_openat(struct nameidata *nd, const struct open_flags *op, unsigned flags) { - const char *s; struct file *file; int error; @@ -3484,22 +3481,17 @@ static struct file *path_openat(struct nameidata *nd, if (unlikely(file->f_flags & __O_TMPFILE)) { error = do_tmpfile(nd, flags, op, file); - goto out2; - } - - if (unlikely(file->f_flags & O_PATH)) { + } else if (unlikely(file->f_flags & O_PATH)) { error = do_o_path(nd, flags, file); - goto out2; - } - - s = path_init(nd, flags); - while (!(error = link_path_walk(s, nd)) && - (error = do_last(nd, file, op)) > 0) { - nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL); - s = trailing_symlink(nd); + } else { + const char *s = path_init(nd, flags); + while (!(error = link_path_walk(s, nd)) && + (error = do_last(nd, file, op)) > 0) { + nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL); + s = trailing_symlink(nd); + } + terminate_walk(nd); } - terminate_walk(nd); -out2: if (likely(!error)) { if (likely(file->f_mode & FMODE_OPENED)) return file; -- 2.11.0