misc/163501: NFS exporting a dir and a subdir in that dir to the same host; mountd error message needs improvement

Peter Maloney peter.maloney at brockmann-consult.de
Wed Dec 21 10:00:27 UTC 2011

>Number:         163501
>Category:       misc
>Synopsis:       NFS exporting a dir and a subdir in that dir to the same host; mountd error message needs improvement
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 21 10:00:26 UTC 2011
>Originator:     Peter Maloney
>Release:        8-STABLE Sept 29 2011
Brockmann Consult
FreeBSD bcnas1.bc.local 8.2-STABLE FreeBSD 8.2-STABLE #0: Thu Sep 29 15:06:03 CEST 2011     root at bcnas1.bc.local:/usr/obj/usr/src/sys/GENERIC  amd64

#works fine
/tank/somedataset1 -maproot=root -network somenetwork/16
/tank/somedataset1 -maproot=root someipaddress1
/tank/somedataset1 -maproot=root someipaddress2
/tank/somedataset1/somesubdir/somesubdir -maproot=root someipaddress4 #even this works
/tank/somedataset2 -maproot=root someipaddress3

#does not work
/tank/somedataset2/somesubdir -maproot=root someipaddress3

Dec 21 09:29:02 bcnas1 mountd[47163]: can't change attributes for /tank/somedataset/somesubdir
Dec 21 09:29:02 bcnas1 mountd[47163]: bad exports list line /tank/somedataset/somesubdir -maproot

The problem is a very bad error message. It should clearly say what rule was being violated. No rules seems to have been broken based on my analysis, so this is a problem.

The handbook, etc. tells me that the option "-alldirs" exists; it is not exactly what I want, but is just as secure in my case, since both the working dataset dir and the subdir use the same ip address, so it is acceptable in this case. And also it would not be acceptable for the other which already works, because the ip is not the same. But it seems to work without that option for that case.

But I don't see something saying that I am not allowed to share the directories separately. So I would say the error message should say what is wrong, ie. "You cannot export a directory that is already exported as a subdirectory to the same host/network. Consider using -alldirs instead. Offending line: ...... previous overlapping line: .....".

I call this a "serious" issue because it is a common thing to do, and works perfectly fine on Linux. If every "common thing" I do today takes as long as this single exports line changed, then I would never get any work done.

Possibly related, but he is only sharing 2 subdirectories, not the parent directory, and this PR is very old and still open:

Here is the forum thread about it (OP using 7.1 - Stable, and I am using 8-STABLE from Sept. 29 2011):
Edit /etc/exports adding 2 lines with the same share and host, except one is a subdirectory of the same share already shared in the first. (-maproot=root might be needed also). And then reload mountd.


/tank/somedataset1 -maproot=root
/tank/somedataset1/subdir -maproot=root

kill -HUP `cat /var/run/mountd.pid` 

I suggest a better error message in this case, such as:
directory is already exported as a subdirectory to the same host/network; consider using -alldirs
Offending line: /tank/somedataset1/subdir -maproot=root
Previous overlapping line: /tank/somedataset1 -maproot=root

But as fix to the exports file, use -alldirs
/tank/somedataset1 -alldirs -maproot=root

But neither fix would help the guy in the other PR 109911, because then he would be exporting /tmp  and all directories under it, instead of just the few he wants.


More information about the freebsd-bugs mailing list