Atomic updates of NFS export lists

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Tue Apr 25 09:49:19 UTC 2006


On Mon, Apr 24, 2006 at 01:56:31PM +0200, Ulrich Spoerlein wrote:
> Andrey Simonenko wrote:
> > [Lots of good stuff]
> > Now mountd does not work if there is some error in exports file.
> > I think this is correct behaviour and I'm ready to explain this.
> 
> Hello Andrey,
> 
> I hope these 'errors' in the exports file only mean syntactical errors?
> For example, I have a /vol partition mounted on my NFS server, which is
> exported via NFS. Now, sometimes /vol is mounted, sometimes it is not
> mounted (on the server). This will generate some warnings from mountd,
> as it can't export the /vol filesystem, but mountd still works the same.
> Once /vol becomes available, I don't even need to restart mountd, it
> will simply pick up /vol and make it available.
> 
> I hope these semantics will remain? (No sorry, I didn't not test your
> patch yet).
> 

In general ignoring lines is not safe, since this can give wrong access
rights.  For example if second line is ignored and /usr/local is in the
same filesystem as /usr, then 10.1.2.3 will match 10.1.2.0/24
and will get r/w access for /usr:

/usr -network 10.1.2.0/24
/usr/local -ro 10.1.2.3

Output from "mountd -t":

Filesystem /usr, type "ufs", fsid 0x43d21dca:0x0225d70c
    Exported directories:
        /usr
	     -network 10.1.2.0/24
        /usr/local
	     -ro 10.1.2.3

I disallowed duplicated export specifications:

/var 10.1.2.3
/var/vol 10.1.2.3

parsing error: exports4:2: duplicated IPv4 address specification 10.1.2.3
was found for /var filesystem

But this can be solved with -quiet option as in your case:

/var 10.1.2.3
/var/vol -quiet 10.1.2.3

parsing error: exports4:2: duplicated IPv4 address specification 10.1.2.3
was found for /var filesystem
parsing error: exports4:2: this line is ignored
Filesystem /var, type "ufs", fsid 0x43d21dcb:0x22fc3751
    Exported directories:
        /var
	     10.1.2.3

When another filesystem is mounted on /var/vol, then:

Filesystem /var, type "ufs", fsid 0x43d21dcb:0x22fc3751
    Exported directories:
        /var
	     10.1.2.3

Filesystem /var/vol, type "ufs", fsid 0x444de7a4:0x96b6cba3
    Filesystem options:
	-quiet
    Exported directories:
        /var/vol
	     10.1.2.3

There is no need to restart mountd as you said, if filesystem is mounted
with mount(8), then mount(8) sends SIGHUP signal to mountd and it reloads
exports file, so it is self-restarted.


More information about the freebsd-hackers mailing list