]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zfs_vnops.c
Fix nfs snapdir automount
authorChunwei Chen <tuxoko@gmail.com>
Wed, 8 Mar 2017 17:26:33 +0000 (09:26 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 8 Mar 2017 17:26:33 +0000 (09:26 -0800)
commit9b77d1c9585572b7ce3af204d40278752d5f5842
treef833d83cdede67ba1a43f1729caa64ebf899a00a
parent463009865fb4398b32a825d7c00cd8a942637fae
Fix nfs snapdir automount

The current implementation for allowing nfs to access snapdir is very buggy.
It uses a special fh for snapdirs, such that the next time nfsd does
fh_to_dentry, it actually returns the root inode inside the snapshot. So nfsd
never knows it cross a mountpoint.

The problem is that nfsd will not hold a reference on the vfsmount of the
snapshot. This cause auto unmounter to unmount the snapshot even though nfs is
still holding dentries in it.

To fix this, we return the inode for the snapdirs themselves. However, we also
trigger automount upon fh_to_dentry, and return ESTALE so nfsd will revalidate
and see the mountpoint and do crossmnt.

Because nfsd will now be aware that these are different filesystems users
must add crossmnt to their export options to access snapshot directories.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #3794
Closes #4716
Closes #5810
Closes #5833
include/sys/zfs_ctldir.h
lib/libshare/nfs.c
man/man8/zfs.8
module/zfs/zfs_ctldir.c
module/zfs/zfs_vfsops.c
module/zfs/zfs_vnops.c