make mountd's -S option the default

Rick Macklem rmacklem at uoguelph.ca
Mon Mar 14 23:27:59 UTC 2016


Alex Burlyga wrote:
> Awesome! Also I noticed that we always blow away all the exports and apply
> exports again on HUP. There are some pathological examples where
> automounter is involved and even though there were no changes we  still
> going through the motions of applying exports. I thought it used to be only
> delta's were applied, but not anymore. Was it  conscious decision, or this
> just needs to be fixed in the new server?
> 
To the best of my knowledge, it has always done a full reload and never deltas.
(If you look at revision log for mountd.c, you'll find minimal changes when
 the new NFS server was added, mostly to add the NFSv4 support.)

Much of this code was written by Herb Hasler who worked for/with me in the
mid to late 1980s. The original intent was that a HUP signal would only be
sent to mountd when /etc/exports had been updated and the sysadmin wanted
those changes to take effect (ie. the sysadmin would always do an explicit
"update now"). I also mention this because the code in mountd.c that parses
/etc/exports has become pretty convoluted over the years and detecting
deltas wouldn't be easy.

Then, a long time ago a change was made to "mount" so that it sends a SIGHUP
to mountd whenever it does a mount (just in case this mount is to be exported). I'm
pretty sure I didn't do this change, because I wouldn't have thought it a
good idea. However, it has been this way for a long time (I took a quick
look and couldn't even find the commit in the log).

It would be tempting to only reload /etc/exports when it is modified (via a
check for the modify time changing), but that would break the case where
/etc/exports hasn't changed but a mount/umount of an underlying file system
has changed the underlying file system structure.

Ideally, "mount" would parse /etc/exports and only send the SIGHUP if the
new mount is exported, but that isn't easy (take a look at mountd.c if you
don't believe me) and has never been done.
--> Of course any mounting/umounting done by an automounter applies here.

If autofs changes the file system structure without sending a SIGHUP to
mountd (directly or via mount(8)), then that could break things. From
your post, it sounds like it does do the SIGHUP. As above, deciding when
this doesn't need to be done isn't easy.

There was an open source utility called nfse which did update exports
atomically, but it never went into FreeBSD, in part because it wasn't
backwards compatible with mountd and /etc/exports (it did everything
at file system mount points from what I understood).

rick

> Alex.
> On Mar 13, 2016 19:21, "Rick Macklem" <rmacklem at uoguelph.ca> wrote:
> 
> > Julian Elischer has volunteered to commit the patches that
> > make the -S option the default for mountd.
> >
> > Without this option, any reload of /etc/exports (which happens
> > whenever any file system is mounted on the server) can result in
> > error replies to NFS clients, due to the file system being temporarily
> > not exported. The only downside I can think of to using this option
> > is a delay observed by NFS clients when large /etc/exports files
> > are reloaded. (Since without the delay they can get error replies,
> > the delay seems preferable.
> >
> > There are several PR#s related to these error replies:
> > 9619, 131342, 206855 (and probably some others)
> >
> > If anyone has a problem with this change in default behaviour,
> > please email.
> >
> > rick
> > _______________________________________________
> > freebsd-fs at freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> > To unsubscribe, send any mail to "freebsd-fs-unsubscribe at freebsd.org"
> >
> 


More information about the freebsd-fs mailing list