Atomic updates of NFS export lists

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Thu May 11 13:41:24 UTC 2006


On Wed, May 10, 2006 at 04:36:24PM -0600, Scott Long wrote:

> >In my environment non-atomic updates of NFS export lists are not
> >acceptable.  So, I decided to correct this problem.  As the result
> >mountd, kern/vfs_export.c were completely rewritten, mount.h,
> >vfs_mount.c and nfs_srvsubs.c also got changes.
> >
> >For details see kern/9619.
> >
> 
> I've been looking at this since my company is also running into these
> problems.  I've integrated your patchset into my tree, and I'll let you
> know how it works after a few days of testing.  One thing to note is
> that you've significantly re-written much of mountd, as well as changed
> the API/ABI a bit and removed some command line switches.

I removed only the "-p <port>" option from mountd.  Initially I added
several options for mountd to allow to specify UDP, TCP services,
addresses and ports, but that gave many lines of code.  One of examples
of such code is located in nfsd.c.

Sockconf library allows in a configuration file to specify all settings
for sockets and an application can use getsockconf() function for getting
all settings in a linked list (similar to the result of the getaddrinfo()
function).

One new important option is -t, which allows to check exports file
and dump parsed configuration.  I thought about changing format of
exports file, but decided to not change anything (almost).

>  That makes it
> less attractive for inclusion in RELENG_6, but is fine for 7-CURRENT.
> With that in mind, you should switch over to using nmount() instead of
> mount(), that way you can completely remove the per-filesystem handling
> code that you added.

What about using nfssvc(2) for this task?

Yes it is possible to use nmount() and remove export_args from all
filesystems, and remove mount_arg("export"...) from all vfs_cmount()
implementation, but...

New version of mountd is very strict about errors and does not ignore
them.  There is a race condition between parsing exports file, passing
parsed configuration to the kernel and mounting/umounting filesystems.
It is possible to make mount(8), umount(8) and mountd(8) to work
synchronous, but this will require changing of mount(8) and umount(8).

In current implementation there are several situations when mountd
can exit with error, e.g. a filesystem was mounted and exported,
then it was unmounted and mountd rereads exports file, since old
filesystem does not exist any more, mountd will report about error
(the kernel will refuse to clear export list for non-existent
filesystem) and exit.  This problem exist before.

This question must be discussed.

> If there is any way that you can trim the changes to just implement the
> new export primitives and leave out the libsock stuff, it would be much
> easier to justify getting into RELENG_6.

This will make code a bit complex as it is now...  The idea of
sockconf library is to simplify some part of code in applications.

>  I don't have an opinion on the
> libsock design, but you should talk to people like Robert Watson about
> that before this goes into 7-CURRENT.

Can you and others also discuss "open questions" from the first letter?


More information about the freebsd-hackers mailing list