From Linux NFS
(Difference between revisions)
|
|
(9 intermediate revisions not shown) |
Line 1: |
Line 1: |
- | [http://news.engin.brown.edu/forums/thread-view.asp?tid=156 fioricet] [http://wc1.worldcrossing.com/WebX/.1de60a10 cheap didrex] [http://wc1.worldcrossing.com/WebX/.1de60a35 free verizon ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=176 ultracet online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=356 tracfone ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=92&forum=13 clomid online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=344 online ativan] [http://news.engin.brown.edu/forums/thread-view.asp?tid=155 buy xanax] [http://news.engin.brown.edu/forums/thread-view.asp?tid=178 buy nexium] [http://wc1.worldcrossing.com/WebX/.1de60a04 free sonyericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=182 clomid online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=82&forum=13 adipex online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=343 cialis] [http://news.engin.brown.edu/forums/thread-view.asp?tid=170 cheap hydrocodone] [http://news.engin.brown.edu/forums/thread-view.asp?tid=169 levitra online] [http://wc1.worldcrossing.com/WebX/.1de609f3 midi ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=111&forum=13 order lisinopril] [http://news.engin.brown.edu/forums/thread-view.asp?tid=224 wwe ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=153 cheap phentermine] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=147&forum=13 free tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=181 cheap sildenafil] [http://news.engin.brown.edu/forums/thread-view.asp?tid=212 free verizon ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=223 midi ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=335 buy phentermine] [http://wc1.worldcrossing.com/WebX/.1de60a00 rivotril online] [http://wc1.worldcrossing.com/WebX/.1de60a0a vicodin online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=187 cheap celexa] [http://wc1.worldcrossing.com/WebX/.1de609eb free funny ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=197 flexeril online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=105&forum=13 cheap hoodia] [http://news.engin.brown.edu/forums/thread-view.asp?tid=188 tenuate online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=180 buy prozac] [http://wc1.worldcrossing.com/WebX/.1de60a05 sprint ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f9 norco online] [http://wc1.worldcrossing.com/WebX/.1de609f2 meridia online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=145&forum=13 sprint ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=96&forum=13 diazepam online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=338 fioricet] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=358 mp3 ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a21 paxil online] [http://wc1.worldcrossing.com/WebX/.1de60a31 buy zanaflex] [http://wc1.worldcrossing.com/WebX/.1de609de alprazolam] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=141&forum=13 soma online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=342 cheap diazepam] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=157&forum=13 free wwe ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=161&forum=13 but zoloft] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=112&forum=13 buy lorazepam] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=124&forum=13 norco] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=355 free free ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=88&forum=13 cheap carisoprodol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=360 free qwest ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=167 clonazepam online] [http://wc1.worldcrossing.com/WebX/.1de60a0e celexa online] [http://wc1.worldcrossing.com/WebX/.1de609e4 cheap clonazepam] [http://wc1.worldcrossing.com/WebX/.1de60a17 buy lipitor] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=123&forum=13 nokia ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=184 lisinopril online] [http://wc1.worldcrossing.com/WebX/.1de60a24 propecia online] [http://wc1.worldcrossing.com/WebX/.1de609f8 nokia ringtones] [http://wc1.worldcrossing.com/WebX/.1de609fd punk ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=154 carisoprodol online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=339 cheap ultram] [http://wc1.worldcrossing.com/WebX/.1de60a34 sony ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=202 free tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=199 cheap zyban] [http://news.engin.brown.edu/forums/thread-view.asp?tid=198 cheap hoodia] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=332 order tramadol] [http://wc1.worldcrossing.com/WebX/.1de60a1d free cingular ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=107&forum=13 jazz ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=219 free alltel ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=101&forum=13 cheap flexeril] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=359 nextel ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a15 free kyocera ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=363 samsung ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=117&forum=13 free motorola ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=346 cheap meridia] [http://wc1.worldcrossing.com/WebX/.1de60a30 xenical online] [http://wc1.worldcrossing.com/WebX/.1de60a03 sony ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=168 paxil online] [http://wc1.worldcrossing.com/WebX/.1de60a01 free sagem ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=160 buy ativan] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=136&forum=13 cheap rivotril] [http://wc1.worldcrossing.com/WebX/.1de609fb order ortho] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=89&forum=13 cheap celexa] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=139&forum=13 sharp ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=163 cheap adipex] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=125&forum=13 cheap ortho] [http://wc1.worldcrossing.com/WebX/.1de609ee hydrocodone] [http://news.engin.brown.edu/forums/thread-view.asp?tid=177 propecia online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=91&forum=13 cingular ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f7 free nextel ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=215 free sagem ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=347 adipex online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=132&forum=13 punk ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=97&forum=13 buy didrex] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=144&forum=13 free sonyericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=179 didrex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=158 diazepam online] [http://wc1.worldcrossing.com/WebX/.1de60a25 free samsung ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a26 free sharp ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=162 meridia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=217 free mono ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=152 cheap valium] [http://wc1.worldcrossing.com/WebX/.1de609ec buy hgh] [http://news.engin.brown.edu/forums/thread-view.asp?tid=205 nextel ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=357 free funny ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=191 cheap lortab] [http://wc1.worldcrossing.com/WebX/.1de60a2b but ultracet] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=153&forum=13 viagra online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=183 albuterol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=349 vicodin online] [http://wc1.worldcrossing.com/WebX/.1de60a18 motorola ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f0 lorazepam online] [http://wc1.worldcrossing.com/WebX/.1de60a12 free ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a19 mp3 ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=216 free sonyericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=161 viagra online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=95&forum=13 cheap cyclobenzaprine] [http://news.engin.brown.edu/forums/thread-view.asp?tid=192 vigrx] [http://wc1.worldcrossing.com/WebX/.1de60a0d wwe ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=185 zoloft online] [http://wc1.worldcrossing.com/WebX/.1de609e3 cheap clomid] [http://wc1.worldcrossing.com/WebX/.1de60a13 order fioricet] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=138&forum=13 samsung ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=83&forum=13 cheap albuterol] [http://wc1.worldcrossing.com/WebX/.1de60a29 tramadol online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=173 cheap xenical] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=350 alprazolam online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=93&forum=13 clonazepam online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=204 mp3 ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=164 cheap norco] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=337 xanax] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=119&forum=13 mtv ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=206 free qwest ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=151&forum=13 online valium] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=140&forum=13 cheap sildenafil] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=162&forum=13 cheap zyban] [http://news.engin.brown.edu/forums/thread-view.asp?tid=166 alprazolam online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=353 levitra online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=333 cheap soma] [http://news.engin.brown.edu/forums/thread-view.asp?tid=189 cheap ortho] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=159&forum=13 xenical online] [http://wc1.worldcrossing.com/WebX/.1de60a36 cheap zyban] [http://wc1.worldcrossing.com/WebX/.1de60a23 free polyphonic ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=208 free motorola ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a1f cheap lisinopril] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=137&forum=13 sagem ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a1b free music ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e0 cheap ativan] [http://news.engin.brown.edu/forums/thread-view.asp?tid=229 free jazz ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e5 cool ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=99&forum=13 ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a07 tracfone ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=348 but norco] [http://wc1.worldcrossing.com/WebX/.1de60a09 cheap viagra] [http://news.engin.brown.edu/forums/thread-view.asp?tid=218 free sony ericsson ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=121&forum=13 cheap nexium] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=126&forum=13 paxil online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=94&forum=13 free cool ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=154&forum=13 cheap vicodin] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=108&forum=13 kyocera ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a14 free jazz ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=210 free sprint ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0f cialis online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=175 cyclobenzaprine online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=200 nokia ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=352 paxil online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=110&forum=13 cheap lipitor] [http://wc1.worldcrossing.com/WebX/.1de609e6 cyclobenzaprine online] [http://wc1.worldcrossing.com/WebX/.1de60a33 cheap prozac] [http://news.engin.brown.edu/forums/thread-view.asp?tid=157 ultram online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=190 cheap pharmacy online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=195 cheap rivotril] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=143&forum=13 sony ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=100&forum=13 fioricet online] [http://wc1.worldcrossing.com/WebX/.1de60a06 tenuate online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=345 cheap viagra] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=135&forum=13 free real ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=193 buy zanaflex] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=115&forum=13 free midi ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=87&forum=13 cheap ativan] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=351 buy clonazepam] [http://wc1.worldcrossing.com/WebX/.1de60a11 diethylpropion online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=152&forum=13 verizon ringtones] [http://wc1.worldcrossing.com/WebX/.1de609ea free free ringtones] [http://wc1.worldcrossing.com/WebX/.1de609fa online pharmacy] [http://news.engin.brown.edu/forums/thread-view.asp?tid=151 soma online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=102&forum=13 free free ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=155&forum=13 online vigrx] [http://wc1.worldcrossing.com/WebX/.1de609f1 lortab online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=226 free sony ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0c wellbutrin online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=104&forum=13 hgh online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=225 kyocera ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=227 ericsson ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=118&forum=13 free mp3 ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a2c but ultram] [http://wc1.worldcrossing.com/WebX/.1de609e1 carisoprodol online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=214 cingular ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=171 order ambien] [http://people.msoe.edu/~millerni/forums.php?show=topic
| + | = The Problem = |
| + | |
| + | NOTE: all of this has since been mostly fixed, so this page is out of date. |
| + | |
| + | See also [http://bugzilla.linux-nfs.org/show_bug.cgi?id=75 This bugzilla bug report], or [http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=237108 This redhat bugzilla report], or [http://marc.info?l=linux-nfs&m=117408234516807&w=2 possibly relevant mail thread]. |
| + | |
| + | While NFSv2 and NFSv3 use a separate mount protocol to discover a server's exported filesystems, NFSv4 uses the same standard filesystem protocol (lookup, readdir, etc.) that is used to traverse within filesystems. |
| + | |
| + | This gives the impression that these filesystems are all mounted on top of a top-level "pseudofilesystem". |
| + | |
| + | Rather than constructing the pseudofilesystem from the list of exports in the /etc/exports file, the nfsd server just uses a real filesystem as the pseudofilesystem, and allows the administrator to mount and export filesystems underneath it. So that the server knows which exported filesystem to use as the pseudofilesystem (the filesystem that NFSv4 clients will see as "/"), that filesystem is marked with the export option "fsid=0". |
| + | |
| + | This system was relatively simple to implement, but has lead to severe problems for automount users, or for anyone attempting to migrate from NFSv2/v3 to v4, because v4 clients see different paths than mountd clients. |
| + | |
| + | For example, to quote Trond: |
| + | |
| + | <pre> |
| + | the current system means that if your export file |
| + | looks like this: |
| + | |
| + | /export/home myclient(rw,sync,no_subtree_check,fsid=0) |
| + | |
| + | then that means that an NFSv4 fstab entry on 'myclient' will look like |
| + | |
| + | myserver:/ /mnt nfs4 rw,hard,intr 0 0 |
| + | |
| + | whereas an NFSv3 entry would look like |
| + | |
| + | myserver:/export/home /mnt nfs rw,hard,intr 0 0 |
| + | |
| + | This difference in path semantics means that there is no way we could |
| + | have 'mount' try NFSv4 first, then automatically fall back to NFSv3 if |
| + | the server doesn't support NFSv4. |
| + | |
| + | What we ought to do (what Solaris, Netapp,... all do) is for the NFSv4 |
| + | server to have a pseudo-fs that contains the entries '/', '/export', and |
| + | '/export/home' so that the NFSv4 client can mount the |
| + | directory /export/home instead of '/'." |
| + | </pre> |
| + | |
| + | You could try to solve this problem in this example by creating a separate pseudofilesystem at |
| + | /var/lib/nfs/v4root, mount --bind'ing /export/home on /var/lib/nfs/v4root/export/home, and creating another export for /var/lib/nfs/v4root/export/home. Then it will be possible to mount myserver:/export/home using either v3 or v4. Unfortunately, anyone using showmount or an automounter will now see a list of exports that looks like |
| + | |
| + | /export/home |
| + | /var/lib/nfs/v4root |
| + | /var/lib/nfs/v4root/export/home |
| + | |
| + | Also, setting up the pseudofilesystem and creating these extra exports is tedious work for the administrator. |
| + | |
| + | But one solution is to modify mountd so that it creates those new exports itself, and hides the resulting new exports from the MOUNT protocol: |
| + | |
| + | = Solving the problem in mountd = |
| + | |
| + | One possible solution can be implemented entirely in mountd, without changing the kernel or any interfaces: |
| + | |
| + | First, if we find "fsid=0" in the /etc/exports file anywhere, then we fall back on the current behavior, to preserve backwards compatibility. |
| + | |
| + | If the file lacks any "fsid=0", then we automatically construct a pseudofilesystem in mountd: |
| + | |
| + | * As above, create a new filesystem at /var/lib/nfs/v4root/ to use as a pseudofilesystem; you'll probably need to loopback-mount a file so the user doesn't have to set aside a separate partition for this. |
| + | * For each export in the export file, create a corresponding path under the pseudofilesystem. |
| + | * Create a new fsid=0,ro export for the pseudofilesystem. |
| + | * For each export in the export file, create a corresponding export for the path under the pseudofilesystem, with the same client and the same options. |
| + | * Mark all of these automatically created exports specially so that mountd knows to use them only for answer upcalls from the kernel, and not for responding to mountd requests. |
| + | |
| + | The end result is an automatically-built filesystem and a set of "shadow" exports that are visible to NFSv4 but not to anyone (NFSv2/3 clients or automounters) using the MOUNT protocol, which have the effect of allowing everyone to see the same export paths. |
| + | |
| + | Note some care has to be taken when reexporting, modifying the export list, etc., not to modify paths in the pseudofilesystem if not necessary; we'd rather not give clients unnecessary STALE errors. Also we should probably save the pseudofilesystem across reboots to prevent filehandles from changing after a reboot. |
| + | |
| + | Also, we should probably hide all the automatically created mountpoints under /var/lib/nfs/v4root/ from other processes on the server; this means mountd should be run in its own namespace (see CLONE_NEWNS in "man 2 clone"). I believe all the lookups done by nfsd are actually done in downcalls that are performed in the context of the downcaller (mountd), so mountd's namespace should be the one it ends up seeing. |
| + | |
| + | For now we probably shouldn't be performing all the above steps by default; we could give mountd an extra commandline option or something. |
| + | |
| + | = Other solutions = |
| + | |
| + | The purely-mountd solution does seem a little complicated. We could build the pseudofilesystem entirely in the kernel, but I think that would require new kernel code and kernel interfaces. Also it might not fit well with the current export table architecture where only mountd every knows the complete list of exports, and kernel just requests information about particular exports as needed. |
| + | |
| + | Other ideas? |
Latest revision as of 22:37, 23 August 2010
The Problem
NOTE: all of this has since been mostly fixed, so this page is out of date.
See also This bugzilla bug report, or This redhat bugzilla report, or possibly relevant mail thread.
While NFSv2 and NFSv3 use a separate mount protocol to discover a server's exported filesystems, NFSv4 uses the same standard filesystem protocol (lookup, readdir, etc.) that is used to traverse within filesystems.
This gives the impression that these filesystems are all mounted on top of a top-level "pseudofilesystem".
Rather than constructing the pseudofilesystem from the list of exports in the /etc/exports file, the nfsd server just uses a real filesystem as the pseudofilesystem, and allows the administrator to mount and export filesystems underneath it. So that the server knows which exported filesystem to use as the pseudofilesystem (the filesystem that NFSv4 clients will see as "/"), that filesystem is marked with the export option "fsid=0".
This system was relatively simple to implement, but has lead to severe problems for automount users, or for anyone attempting to migrate from NFSv2/v3 to v4, because v4 clients see different paths than mountd clients.
For example, to quote Trond:
the current system means that if your export file
looks like this:
/export/home myclient(rw,sync,no_subtree_check,fsid=0)
then that means that an NFSv4 fstab entry on 'myclient' will look like
myserver:/ /mnt nfs4 rw,hard,intr 0 0
whereas an NFSv3 entry would look like
myserver:/export/home /mnt nfs rw,hard,intr 0 0
This difference in path semantics means that there is no way we could
have 'mount' try NFSv4 first, then automatically fall back to NFSv3 if
the server doesn't support NFSv4.
What we ought to do (what Solaris, Netapp,... all do) is for the NFSv4
server to have a pseudo-fs that contains the entries '/', '/export', and
'/export/home' so that the NFSv4 client can mount the
directory /export/home instead of '/'."
You could try to solve this problem in this example by creating a separate pseudofilesystem at
/var/lib/nfs/v4root, mount --bind'ing /export/home on /var/lib/nfs/v4root/export/home, and creating another export for /var/lib/nfs/v4root/export/home. Then it will be possible to mount myserver:/export/home using either v3 or v4. Unfortunately, anyone using showmount or an automounter will now see a list of exports that looks like
/export/home
/var/lib/nfs/v4root
/var/lib/nfs/v4root/export/home
Also, setting up the pseudofilesystem and creating these extra exports is tedious work for the administrator.
But one solution is to modify mountd so that it creates those new exports itself, and hides the resulting new exports from the MOUNT protocol:
Solving the problem in mountd
One possible solution can be implemented entirely in mountd, without changing the kernel or any interfaces:
First, if we find "fsid=0" in the /etc/exports file anywhere, then we fall back on the current behavior, to preserve backwards compatibility.
If the file lacks any "fsid=0", then we automatically construct a pseudofilesystem in mountd:
- As above, create a new filesystem at /var/lib/nfs/v4root/ to use as a pseudofilesystem; you'll probably need to loopback-mount a file so the user doesn't have to set aside a separate partition for this.
- For each export in the export file, create a corresponding path under the pseudofilesystem.
- Create a new fsid=0,ro export for the pseudofilesystem.
- For each export in the export file, create a corresponding export for the path under the pseudofilesystem, with the same client and the same options.
- Mark all of these automatically created exports specially so that mountd knows to use them only for answer upcalls from the kernel, and not for responding to mountd requests.
The end result is an automatically-built filesystem and a set of "shadow" exports that are visible to NFSv4 but not to anyone (NFSv2/3 clients or automounters) using the MOUNT protocol, which have the effect of allowing everyone to see the same export paths.
Note some care has to be taken when reexporting, modifying the export list, etc., not to modify paths in the pseudofilesystem if not necessary; we'd rather not give clients unnecessary STALE errors. Also we should probably save the pseudofilesystem across reboots to prevent filehandles from changing after a reboot.
Also, we should probably hide all the automatically created mountpoints under /var/lib/nfs/v4root/ from other processes on the server; this means mountd should be run in its own namespace (see CLONE_NEWNS in "man 2 clone"). I believe all the lookups done by nfsd are actually done in downcalls that are performed in the context of the downcaller (mountd), so mountd's namespace should be the one it ends up seeing.
For now we probably shouldn't be performing all the above steps by default; we could give mountd an extra commandline option or something.
Other solutions
The purely-mountd solution does seem a little complicated. We could build the pseudofilesystem entirely in the kernel, but I think that would require new kernel code and kernel interfaces. Also it might not fit well with the current export table architecture where only mountd every knows the complete list of exports, and kernel just requests information about particular exports as needed.
Other ideas?