Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1829997ybl; Thu, 30 Jan 2020 06:47:09 -0800 (PST) X-Google-Smtp-Source: APXvYqyZFHtcv7l9pQ55wh9QR/MyibZOY+nYoDE87ZNX5+4/nEhk4XsehRVzXX6e+SKzienb5FIa X-Received: by 2002:a05:6830:1094:: with SMTP id y20mr3804942oto.12.1580395629706; Thu, 30 Jan 2020 06:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580395629; cv=none; d=google.com; s=arc-20160816; b=gQtgdVBlsG6vUkxWpAM8d8fhKr0+u9OIxw08D4ZsGOU/Kj9XCU/YWVK6+VaauRkT0T Br43v9pxH5vFKDhVY+nLgYML38iAepo1+Rniu6da087A6ggdu66G9Zo3jMIgBLQMnikp YgXFA/imHuSIQtWA6uIPoftE3uv3tmNPqjPj5itzhwHII+Ly+2h+hZJlxnJYbAGgH+xw zJgwB7EmdRNhg6RwXbnw4lZVB/1d286VRGf3kjYScapr22oX1z4ZiorfRh0/4UCmTaOp jFztOlUROWyZAXDY49m9x7TNQnLW8Y3sMbj8WcA+T+A4jM48iG7/zxMbGTqXRtLAJIEr ZAnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZB6YINtSfGANVy/v7ieQyxJxDxGWUnwBahjFAhcLqfw=; b=EJolE6ZnTjTm7xlq1aCuCXJCJTL60dOise86If+W8jgOcYgEUc5nQMHT0wtGjcvkeH KT81EdXnWZKqFQA7V4Ykb34Rq+RRD+BwK/mLguDSYEST3NoZCKjPgpbtrRdZJGWy+JvR XeT/x8Bn5JHNQJS+OjJK+tWdfZdeyk2Li3pmkuHkspNHlAVk45U0Ag9g51sPRPK3AibD GSAi4ydE/wWblUqPJnT0NyNMS1DYLTatwHAcOVecLkhqluIGLi1QJGh+FMMKdW/sNJR2 vdAXejF1c7g817v5SXS0/I3Pdgx1imxVjC1S6pEoeOYB1ShwhKtsuUm4/+qzdZHuMWNm 31Wg== 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 p14si3441713ota.71.2020.01.30.06.46.56; Thu, 30 Jan 2020 06:47:09 -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 S1727299AbgA3OpX (ORCPT + 99 others); Thu, 30 Jan 2020 09:45:23 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:60653 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgA3OpW (ORCPT ); Thu, 30 Jan 2020 09:45:22 -0500 Received: from [109.134.33.162] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ixB4K-0002Bk-94; Thu, 30 Jan 2020 14:45:20 +0000 Date: Thu, 30 Jan 2020 15:45:20 +0100 From: Christian Brauner To: Al Viro Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds , linux-kernel@vger.kernel.org, Aleksa Sarai , David Howells , Eric Biederman Subject: Re: [PATCH 04/17] follow_automount() doesn't need the entire nameidata Message-ID: <20200130144520.hnf2yk5tjalxfddn@wittgenstein> References: <20200119031423.GV8904@ZenIV.linux.org.uk> <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> <20200119031738.2681033-4-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200119031738.2681033-4-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 19, 2020 at 03:17:16AM +0000, Al Viro wrote: > From: Al Viro > > only the address of ->total_link_count and the flags > > Signed-off-by: Al Viro > --- > fs/namei.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/namei.c b/fs/namei.c > index d30a74a18da9..3b6f60c02f8a 100644 > --- a/fs/namei.c > +++ b/fs/namei.c > @@ -1133,7 +1133,7 @@ EXPORT_SYMBOL(follow_up); > * - return -EISDIR to tell follow_managed() to stop and return the path we > * were called with. > */ > -static int follow_automount(struct path *path, struct nameidata *nd) > +static int follow_automount(struct path *path, int *count, unsigned lookup_flags) > { > struct dentry *dentry = path->dentry; > > @@ -1148,13 +1148,12 @@ static int follow_automount(struct path *path, struct nameidata *nd) > * as being automount points. These will need the attentions > * of the daemon to instantiate them before they can be used. > */ > - if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | > + if (!(lookup_flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | > LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) && > dentry->d_inode) > return -EISDIR; > > - nd->total_link_count++; > - if (nd->total_link_count >= 40) > + if (count && *count++ >= 40) He, side-effects galore. :) Isn't this incrementing the address but you want to increment the counter? Seems like this should be if (count && (*count)++ >= 40) and even then it seems to me not incrementing at all when we have hit the limit seems more natural? Christian