Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932763AbbEKS2D (ORCPT ); Mon, 11 May 2015 14:28:03 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:47253 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbbEKSIW (ORCPT ); Mon, 11 May 2015 14:08:22 -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 058/110] trailing_symlink: nd->depth massage, part 7 Date: Mon, 11 May 2015 19:07:18 +0100 Message-Id: <1431367690-5223-58-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: 1612 Lines: 65 From: Al Viro move decrement of nd->depth on successful returns into the callers. Signed-off-by: Al Viro --- fs/namei.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 93b5f73..9df1c7a 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2009,10 +2009,8 @@ static int trailing_symlink(struct nameidata *nd) s = get_link(nd); if (unlikely(IS_ERR(s))) return PTR_ERR(s); - if (unlikely(!s)) { - nd->depth--; + if (unlikely(!s)) return 0; - } if (*s == '/') { if (!nd->root.mnt) set_root(nd); @@ -2028,7 +2026,6 @@ static int trailing_symlink(struct nameidata *nd) put_link(nd); return error; } - nd->depth--; return 0; } @@ -2069,6 +2066,7 @@ static int path_lookupat(int dfd, const struct filename *name, if (err) break; err = lookup_last(nd); + nd->depth--; put_link(nd); } } @@ -2418,6 +2416,7 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path, if (err) break; err = mountpoint_last(nd, path); + nd->depth--; put_link(nd); } out: @@ -3302,6 +3301,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, if (unlikely(error)) break; error = do_last(nd, file, op, &opened, pathname); + nd->depth--; put_link(nd); } out: -- 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/