Return-Path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:50125 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979Ab1I0D6U convert rfc822-to-8bit (ORCPT ); Mon, 26 Sep 2011 23:58:20 -0400 Received: by wyg34 with SMTP id 34so6679517wyg.19 for ; Mon, 26 Sep 2011 20:58:19 -0700 (PDT) In-Reply-To: <1317085155.21770.17.camel@lade.trondhjem.org> References: <1316747758.3346.89.camel@perseus.themaw.net> <20110922134510.24683.14576.stgit@warthog.procyon.org.uk> <1316707443.3346.44.camel@perseus.themaw.net> <1316709935.3346.48.camel@perseus.themaw.net> <20110922133529.6d3ea8de@barsoom.rdu.redhat.com> <20110922144453.6cf53a25@barsoom.rdu.redhat.com> <1316719228.3968.14.camel@lade.trondhjem.org> <2E1EB2CF9ED1CB4AA966F0EB76EAB4430B480BD4@SACMVEXC2-PRD.hq.netapp.com> <21772.1316774025@redhat.com> <1316788444.14812.10.camel@lade.trondhjem.org> <29743.1316791138@redhat.com> <87hb43tf2g.fsf@tucsk.pomaz.szeredi.hu> <1316827854.3346.154.camel@perseus.themaw.net> <20110924073610.4b045189@tlielax.poochiereds.net> <1317013864.3187.81.camel@perseus.themaw.net> <1317071626.19951.8.camel@lade.trondhjem.org> <1317072718.19951.13.camel@lade.trondhjem.org> <1317076424.19951.32.camel@lade.trondhjem.org> <1317078563.21770.8.camel@lade.trondhjem.org> <1317085155.21770.17.camel@lade.trondhjem.org> From: Linus Torvalds Date: Mon, 26 Sep 2011 20:57:59 -0700 Message-ID: Subject: Re: [PATCH] VFS: Suppress automount on [l]stat, [l]getxattr, etc. To: Trond Myklebust Cc: Ian Kent , Jeff Layton , Miklos Szeredi , David Howells , viro@zeniv.linux.org.uk, gregkh@suse.de, linux-nfs@vger.kernel.org, leonardo.lists@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-nfs-owner@vger.kernel.org List-ID: MIME-Version: 1.0 On Mon, Sep 26, 2011 at 5:59 PM, Trond Myklebust wrote: > diff --git a/fs/namei.c b/fs/namei.c > index f478836..5b1608f 100644 > --- a/fs/namei.c > +++ b/fs/namei.c > @@ -724,25 +724,9 @@ static int follow_automount(struct path *path, unsigned flags, > ? ? ? ?/* We don't want to mount if someone supplied AT_NO_AUTOMOUNT > ? ? ? ? * and this is the terminal part of the path. > ? ? ? ? */ > - ? ? ? if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) > + ? ? ? if (!(flags & LOOKUP_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) > ? ? ? ? ? ? ? ?return -EISDIR; /* we actually want to stop here */ > > - ? ? ? /* We don't want to mount if someone's just doing a stat - > - ? ? ? ?* unless they're stat'ing a directory and appended a '/' to > - ? ? ? ?* the name. > - ? ? ? ?* > - ? ? ? ?* We do, however, want to mount if someone wants to open or > - ? ? ? ?* create a file of any type under the mountpoint, wants to > - ? ? ? ?* traverse through the mountpoint or wants to open the > - ? ? ? ?* mounted directory. ?Also, autofs may mark negative dentries > - ? ? ? ?* as being automount points. ?These will need the attentions > - ? ? ? ?* of the daemon to instantiate them before they can be used. > - ? ? ? ?*/ > - ? ? ? if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | > - ? ? ? ? ? ? ? ? ? ?LOOKUP_OPEN | LOOKUP_CREATE)) && > - ? ? ? ? ? path->dentry->d_inode) > - ? ? ? ? ? ? ? return -EISDIR; > - > ? ? ? ?current->total_link_count++; > ? ? ? ?if (current->total_link_count >= 40) > ? ? ? ? ? ? ? ?return -ELOOP; So I think that dropping the d_inode test is wrong, even if we were to at some point decide that we want explicit LOOKUP_AUTOMOUNT everywhere. Of course, it may be that the comment is wrong. But assuming the comment is correct, then it's really the test above that is fundamentally wrong. Ian may know the answer. Ian? Regardless, I applied the minimal and obviously safe part of the patch, so hopefully we have no actual regressions left in this area, and it's just a discussion about possible future cleanups. Linus