Re: 14.1 NFS / mountd : -alldirs not working as expected

From: Michael Proto <mike_at_jellydonut.org>
Date: Thu, 21 Nov 2024 21:56:13 UTC
On Thu, Nov 21, 2024 at 7:11 AM Rick Macklem <rick.macklem@gmail.com> wrote:
>
> On Wed, Nov 20, 2024 at 8:01 PM Michael Proto <mike@jellydonut.org> wrote:
> >
> > Hello all,
> >
> > Running into an issue with a 14.1 server that I think is a bug, though
> > it may be me not interpreting documentation correctly so I wanted to
> > ask here.
> =alldirs simply means that any directory within the server file system
> can be mounted. So, yes, everything up to the root dir can be mounted.
>
> Normally, the directory for such an exports line would be the root directory
> of the file system, but I doubt mountd actually enforces that, since the export
> line is for "all directories" in the file system.
>
> >
> > Using NFSv3, with FreeBSD 14.1 as the NFS server. Based on what I see
> > in exports(5), if I want to export conditional mounts (IE filesystem
> > paths that are intermittently mounted locally on server)
> No idea what you mean by "intermittently mounted locally"?
> (An export will be for whatever file system is mounted for the directory
> at the time mountd is started or updates exports when a SIGHUP is
> sent to it.)
>
> Exporting a file system that is not always mounted on the server is
> a very bad idea imho. It would be much better to add the exports(5)
> line after the file system is mounted and remove it before the file
> system is unmounted, if you need to export a file system not always
> mounted.
>

Agreed, for the rare circumstances where I use this the playbook has
always been to update /etc/exports before and after any (un)mounting,
just interested if mountd would programmatically enforce it for the
hopefully-rare time such steps are overlooked. Seeing that error in
the mountd.c code gave me hope mountd itself could assist there,
regardless I have other ways of achieving the same result.

Appreciate the response.


-Michael Proto