Re: [PATCH 2/3] fs: namei: Allow follow_down() to uncover auto mounts

From: Jeff Layton
Date: Thu Nov 17 2022 - 16:42:49 EST


On Thu, 2022-11-17 at 22:12 +0100, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "Jeff Layton" <jlayton@xxxxxxxxxx>
> > What happens when CROSSMOUNT isn't enabled and someone tries to stroll
> > into an automount point? I'm guessing the automount happens but the
> > export is denied?
>
> Exactly.
>
> On the other hand, why should knfsd not trigger automounts?
> Almost any userspace interaction would also do so.
>

I have no issue with knfsd activity triggering an automount, but I think
it'd be best if we don't do that when knfsd can't do anything with the
resulting filesystem. Automounts can be expensive.

> > It seems like LOOKUP_AUTOMOUNT ought to be conditional
> > on the parent export having CROSSMOUNT set.
> >
> > There's also another caller of follow_down too, the UNIX98 pty code.
> > This may be harmless for it, but it'd be best not to perturb that if we
> > can help it.
> >
> > Maybe follow_down can grow a lookupflags argument?
>
> So, in nfsd_cross_mnt() the follow_down() helper should use LOOKUP_AUTOMOUNT only
> if exp->ex_flags & NFSEXP_CROSSMOUNT is true?
> Sounds sane, thanks for the pointer.
>

Yeah, I think so. I do wonder if we ought to make any provision for
"nohide" exports, but since you have to enumerate those explicitly, it
shouldn't be a huge problem for someone to just ensure that they're
mounted beforehand.

--
Jeff Layton <jlayton@xxxxxxxxxx>