Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755517AbbEKSYh (ORCPT ); Mon, 11 May 2015 14:24:37 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:47322 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754985AbbEKSIY (ORCPT ); Mon, 11 May 2015 14:08:24 -0400 From: Al Viro To: Linus Torvalds Cc: Neil Brown , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 068/110] namei: have terminate_walk() do put_link() on everything left Date: Mon, 11 May 2015 19:07:28 +0100 Message-Id: <1431367690-5223-68-git-send-email-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <20150511180650.GA4147@ZenIV.linux.org.uk> References: <20150511180650.GA4147@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1675 Lines: 70 From: Al Viro All callers of terminate_walk() are followed by more or less open-coded eqiuvalent of "do put_link() on everything left in nd->stack". Better done in terminate_walk() itself, and when we go for RCU symlink traversal we'll have to do it there anyway. Signed-off-by: Al Viro --- fs/namei.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 26466fb..31da717 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1562,6 +1562,8 @@ static void terminate_walk(struct nameidata *nd) nd->root.mnt = NULL; rcu_read_unlock(); } + while (unlikely(nd->depth)) + put_link(nd); } /* @@ -1856,8 +1858,6 @@ Walked: } } terminate_walk(nd); - while (unlikely(nd->depth)) - put_link(nd); return err; OK: if (!nd->depth) /* called from path_init(), done */ @@ -2374,8 +2374,6 @@ done: error = 0; out: terminate_walk(nd); - if (nd->depth) - put_link(nd); return error; } @@ -2978,8 +2976,6 @@ static int do_last(struct nameidata *nd, error = handle_dots(nd, nd->last_type); if (unlikely(error)) { terminate_walk(nd); - if (nd->depth) - put_link(nd); return error; } goto finish_open; @@ -3176,8 +3172,6 @@ out: mnt_drop_write(nd->path.mnt); path_put(&save_parent); terminate_walk(nd); - if (nd->depth) - put_link(nd); return error; exit_dput: -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/