Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .zfs/snapshot access via NFS #1655

Closed
wants to merge 9 commits into from

Conversation

andrey-ve
Copy link
Contributor

This should fix #616 - support .zfs/snapshot access via NFS.

Current solution works until HAVE_MOUNT_NODEV disabled - more info can be found in : 73d84cf

During the development few issues not related directly to #616 have bin fixed as well:

  • fix invalid fileid for snapshot root dentry : a78466c
  • set MNT_SHRINKABLE on snapshot mount instead of occasional post mount getattr : 3c4061c
  • zfsctl: don't sync (to disk) incore only nodes : 2f8344d

@napobo3
Copy link

napobo3 commented Aug 15, 2013

Great job, andrey-ve !

@behlendorf
Copy link
Contributor

@andrey-ve Excellent work! I'm thrilled someone had an opportunity to work on this. I'm not going to be able to review this immediately, but it would be very helpful if those who are interested in this support began testing this patch stack.

@sriccio
Copy link

sriccio commented Aug 21, 2013

Hi! @behlendorf Actually I've tested @andrey-ve patches on one of our zfs filers where we needed to access zfs snapshots from remotes linux clients via NFS and I can confirm it's fully working. We got no problem with it so far. Excellent work :)

@behlendorf
Copy link
Contributor

Good news! I still need to review these, but I did run the patches through automated testing. That uncovered some kernel compatibility issues which need to be resolved. It would be great to test build with a more more kernels and sort these out.

zfs-0.6.1/module/zfs/zfs_ctldir.c:983:2: error: implicit declaration of
function 'path_lookup' [-Werror=implicit-function-declaration]

For this initial failure the spl_kern_path_parent compatibility function can be used as a replacement for path_lookup.

@lclementi
Copy link

Tested @andrey-ve patches on Centos:
Linux rocks-152.sdsc.edu 2.6.32-279.14.1.el6.x86_64

Thanks for the great work

@Milan-Benes
Copy link

@behlendorf : Hello Brian,
is there any quick fix for the "zfs-0.6.1/module/zfs/zfs_ctldir.c:983:2: error: implicit declaration of
function 'path_lookup' [-Werror=implicit-function-declaration]" error? I am using ZFSOnLinux 0.6.2 in Gentoo, kernel 3.10.25. The spl_kern_path_parent seems to be a macro, which expands back to path_lookup, so I am back on square one.

@behlendorf
Copy link
Contributor

@Milan-Benes Not a trivial fix, but this should be resolvable with a little work. Getting all the kernel portability code in place is one of the things blocking these changes from being merged. If someone could work on getting these changes building under 3.11 that would be a good start.

@andrey-ve
Copy link
Contributor Author

Hi

First off thanks for testing patchset on different platforms & just for support.
Sorry for been unresponsive for soooooo long.

Currently I'm working on this compatibility issue, I'll update in the beginning of next week regarding the status of this fix.

@behlendorf
Copy link
Contributor

@andrey-ve That would be great. If you can add the needed autoconf code to get things building under say 2.6.32 and 3.11 that would go a long way towards getting this ready to be merged. I'm happy to run it through our local build farm to check the other kernel versions for you.

When it's need to decode snapshot file handly it hard to get snapshot sb.
On the contrary on snapshot mount it's easy to get snapshot sb because
mount path available in the context of snapshot mount.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
Prevents NFS client from detection of different fileids of snapshot root dentry
before & after snapshot mount.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
Encoded file handle should provide enough info in order to detect right objsetid
and right object in the objset defined by objsetid.

If objsetid not provided (<fh langth> == SHORT_FID_LEN) it's assumed that
objset of the exported fs should be used.

The objsetid should be encoded for every snapshot dentry including root dentry;
	for snapshot root dentry zf_gen should be 0

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
In order to decode long file handly containing snapshot objsetid:
	1 If snapshot defined by objsetid not mounted than it should be mounted;
		to trigger snapshot automount path_lookup(<full snapshot path>) issued
		(see 'save vfsmount to extract path to trigger automount' for
		details about getting <full snapshot path>).
	2 Once snapshot mounted sb of the snapshot should be provided;
		(see 'save snapshot root dentry on snapshot mount'
		for details about getting sb of mounted snapshot).
	3 If zf_gen of fh is 0 & sb got by objsetid is snapshot sb (actually
		long file handly used for snapshots only), then consider fh
		as snapshot root dentryi fh.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
When decoding snapshot file handly it may happen that the snapshot pointed
by the handly currently not mounted, consequently snapshot automount should
be triggered.

In order to trigger automount path_lookup(<full path to snapshot>) need to be
issued. The <full path to snapshot> should be something like:
<zfs mount point>/<ctl dir name>/snapshot/<snapshot name>

Unfortunately, <zfs mount point> part of the path isn't available in the
context of file handly decoding.
A simple way to have a <zfs mount point> in the context of file handly
decoding is to save pointer to struct vfsmount in the context of super block
creation.

Limitations:
	1 Unfortunately it's kinda hack; in general struct vfsmount shouldn't be
		accessed in the context of the filesystem itself.
	2 Once HAVE_MOUNT_NODEV enabled current implementation wont work at all;
		It's looks like possible to port it to kernel version where
		HAVE_MOUNT_NODEV enabled but it will remain rather HACK than
		solution.
	3 Theoretically the proper solution of the problem is to eliminate usage
		of automount and/or mount at all; just generate all snapshot
		related in core structures (inodes/dentries etc.) on access.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>

Conflicts:
	include/sys/zfs_vfsops.h
	module/zfs/zfs_vfsops.c

Conflicts:

	include/sys/zfs_vfsops.h
	module/zfs/zfs_ctldir.c
	module/zfs/zfs_vfsops.c

Conflicts:
	module/zfs/zfs_vfsops.c
Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
dmu_snapshot_list_next offp argument (ctx->pos) and dir_emit ctx->pos argument
should have same value for reading same snapshot directory.
dmu_snapshot_list_next modifies offp argument to point to next entry in the
list. In order to provide dir_emmit with ctx->pos having same value as before
call to dmu_snapshot_list_next temporary variable should be used and the value
of ctx->pos should be updated right before the next call to
dmu_snapshot_list_next.

This fixes a regression that was introduced in commit
0f37d0c Linux 3.11 compat: fops->iterate().

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
@ghost
Copy link

ghost commented Apr 1, 2014

Some testing on SLES11 SP3 (obs build instance):

The path_lookup() is also triggered on SLES' 3.0.101 kernel so it looks like a proper autoconf check is required.

@Milan-Benes:

Since spl_kern_path_parent macro can expand to either path_lookup(path, LOOKUP_PARENT, nd), kern_path_parent_fn(path, nd) or kern_path_parent(path, nd), a quick and very, very dirty fix would be to manually patch and build if you're desperate for the functionality.

Note that the kern_ functions use 2 arguments and not 3 so (I'm going to hell for this!) the middle one needs to go.

So after applying #1655 to 0.6.2 you can try something like this:

--- module/zfs/zfs_ctldir.c.orig        2014-04-01 12:48:37.756605773 +0100
+++ module/zfs/zfs_ctldir.c     2014-04-01 12:50:58.674195921 +0100
@@ -997,8 +997,8 @@
                goto out_path_buff;
        }

-       error = path_lookup(path_buff, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &nd);
-       if (!error)
+       error = kern_path_parent(path_buff, &nd);
+       if (!error)
                path_put(&nd.path);

 out_path_buff:

It builds but be warned, may eat your gerbil.

Edit:

ZFS: snapshot home/tank@auto_daily-2014-03-27-1600 auto mounted at /home/tank/.zfs/snapshot/auto_daily-2014-03-27-1600 unexpectedly unmounted

And a nice NULL pointer:

Apr  1 13:32:24 hematus kernel: [   83.305579] ZFS: snapshot home/tank@auto_daily-2014-03-27-1600 auto mounted at /home/tank/.zfs/snapshot/auto_daily-2014-03-27-1600 unexpectedly unmounted
Apr  1 13:35:00 hematus kernel: [  239.301971] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
Apr  1 13:35:00 hematus kernel: [  239.301978] IP: [<ffffffffa065e3a6>] zfsctl_lookup_snapshot_path+0x1a6/0x2c0 [zfs]
Apr  1 13:35:00 hematus kernel: [  239.302022] PGD 0
Apr  1 13:35:00 hematus kernel: [  239.302024] Oops: 0000 [#1] SMP
Apr  1 13:35:00 hematus kernel: [  239.302027] CPU 10
Apr  1 13:35:00 hematus kernel: [  239.302028] Modules linked in: md5 nfsd autofs4 binfmt_misc edd nfs lockd fscache auth_rpcgss nfs_acl sunrpc mpt3sas mpt2sas scsi_transport_sas raid_class mptctl mptbase bonding mperf microcode ext3 jbd mbcache loop flashcache(FN) pciehp zfs(PFN) zcommon(PFN) znvpair(PFN) zavl(PFN) zunicode(PFN) spl(FN) ipv6 ipv6_lib zlib_deflate ixgbe joydev usbhid hid igb usb_storage dca ptp dcdbas(X) pcspkr shpchp pci_hotplug sr_mod mei ses iTCO_wdt cdrom enclosure iTCO_vendor_support button wmi acpi_power_meter rtc_cmos pps_core acpi_pad sg mdio xfs dm_mirror dm_region_hash dm_log linear ehci_hcd usbcore usb_common sd_mod crc_t10dif processor thermal_sys hwmon scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh dm_snapshot dm_mod ahci libahci libata megaraid_sas scsi_mod
Apr  1 13:35:00 hematus kernel: [  239.302072] Supported: No, Proprietary and Unsupported modules are loaded
Apr  1 13:35:00 hematus kernel: [  239.302074]
Apr  1 13:35:00 hematus kernel: [  239.302076] Pid: 7433, comm: nfsd Tainted: PF          NX 3.0.101-0.15-default #1 Dell Inc. PowerEdge R720/0X3D66
Apr  1 13:35:00 hematus kernel: [  239.302080] RIP: 0010:[<ffffffffa065e3a6>]  [<ffffffffa065e3a6>] zfsctl_lookup_snapshot_path+0x1a6/0x2c0 [zfs]
Apr  1 13:35:00 hematus kernel: [  239.302099] RSP: 0018:ffff8817dbee99e0  EFLAGS: 00010246
Apr  1 13:35:00 hematus kernel: [  239.302100] RAX: 0000000000000000 RBX: ffff8817f116c000 RCX: 0000000000000020
Apr  1 13:35:00 hematus kernel: [  239.302102] RDX: ffff8817f116e4c8 RSI: 0000000000001000 RDI: ffff8817dbee9ab0
Apr  1 13:35:00 hematus kernel: [  239.302104] RBP: 0000000000000da2 R08: e848000000000000 R09: 1200000000000000
Apr  1 13:35:00 hematus kernel: [  239.302106] R10: 0000000000000000 R11: ffffffff8120f630 R12: ffff8817dbee9b60
Apr  1 13:35:00 hematus kernel: [  239.302108] R13: ffff8817f116e4c8 R14: ffff8817f116c000 R15: 0000000000000006
Apr  1 13:35:00 hematus kernel: [  239.302110] FS:  0000000000000000(0000) GS:ffff88187faa0000(0000) knlGS:0000000000000000
Apr  1 13:35:00 hematus kernel: [  239.302112] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
Apr  1 13:35:00 hematus kernel: [  239.302114] CR2: 0000000000000020 CR3: 0000000001a09000 CR4: 00000000001407e0
Apr  1 13:35:00 hematus kernel: [  239.302116] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Apr  1 13:35:00 hematus kernel: [  239.302118] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Apr  1 13:35:00 hematus kernel: [  239.302120] Process nfsd (pid: 7433, threadinfo ffff8817dbee8000, task ffff8817dbee6380)
Apr  1 13:35:00 hematus kernel: [  239.302122] Stack:
Apr  1 13:35:00 hematus kernel: [  239.302123]  0000000000011800 ffff8817dbee9c44 ffff88187f429a00 0000000000000da2
Apr  1 13:35:00 hematus kernel: [  239.302129]  ffff8817dbee9bd8 0000000000000004 0000000000000004 00000000000000a8
Apr  1 13:35:00 hematus kernel: [  239.302133]  00000000000000a8 ffffffff81145a8e ffff8817f420d400 ffff8817f1656800
Apr  1 13:35:00 hematus kernel: [  239.302137] Call Trace:
Apr  1 13:35:00 hematus kernel: [  239.302221]  [<ffffffffa065e52b>] zfsctl_lookup_objset+0x6b/0x90 [zfs]
Apr  1 13:35:00 hematus kernel: [  239.302284]  [<ffffffffa0672241>] zfs_vget+0xf1/0x350 [zfs]
Apr  1 13:35:00 hematus kernel: [  239.302356]  [<ffffffffa068edf1>] zpl_fh_to_dentry+0x41/0x60 [zfs]
Apr  1 13:35:00 hematus kernel: [  239.302420]  [<ffffffff811d69df>] exportfs_decode_fh+0x6f/0x290
Apr  1 13:35:00 hematus kernel: [  239.302429]  [<ffffffffa086198d>] nfsd_set_fh_dentry+0x17d/0x380 [nfsd]
Apr  1 13:35:00 hematus kernel: [  239.302440]  [<ffffffffa0861d6b>] fh_verify+0x1db/0x2b0 [nfsd]
Apr  1 13:35:00 hematus kernel: [  239.302448]  [<ffffffffa0870b41>] nfsd4_proc_compound+0x341/0x520 [nfsd]
Apr  1 13:35:00 hematus kernel: [  239.302463]  [<ffffffffa085e381>] nfsd_dispatch+0xb1/0x250 [nfsd]
Apr  1 13:35:00 hematus kernel: [  239.302474]  [<ffffffffa07826a3>] svc_process_common+0x333/0x620 [sunrpc]
Apr  1 13:35:00 hematus kernel: [  239.302488]  [<ffffffffa0782ce1>] svc_process+0x101/0x160 [sunrpc]
Apr  1 13:35:00 hematus kernel: [  239.302500]  [<ffffffffa085eb3d>] nfsd+0xcd/0x150 [nfsd]
Apr  1 13:35:00 hematus kernel: [  239.302505]  [<ffffffff81082966>] kthread+0x96/0xa0
Apr  1 13:35:00 hematus kernel: [  239.302511]  [<ffffffff81469ee4>] kernel_thread_helper+0x4/0x10
Apr  1 13:35:00 hematus kernel: [  239.302514] Code: 00 00 00 00 00 48 8b 87 c8 34 00 00 4c 8d af c8 24 00 00 48 8d bc 24 d0 00 00 00 be 00 10 00 00 4c 89 ea 48 89 84 24 d0 00 00 00
Apr  1 13:35:00 hematus kernel: <48>[  239.302527]  8b 40 20 48 89 84 24 d8 00 00 00 e8 49 fd ff ff 85 c0 0f 84
Apr  1 13:35:00 hematus kernel: [  239.302533] RIP  [<ffffffffa065e3a6>] zfsctl_lookup_snapshot_path+0x1a6/0x2c0 [zfs]
Apr  1 13:35:00 hematus kernel: [  239.302551]  RSP <ffff8817dbee99e0>
Apr  1 13:35:00 hematus kernel: [  239.302552] CR2: 0000000000000020
Apr  1 13:35:00 hematus kernel: [  239.302554] ---[ end trace c16be50e3596fc64 ]---

So yeah, doesn't work just yet.

@andrey-ve
Copy link
Contributor Author

@jzachwieja Please check your SLES11 SP3 kernel.
Does it have HAVE_MOUNT_NODEV define enabled (see the poll message first)?

@ghost
Copy link

ghost commented Apr 2, 2014

@andrey-ve

I grepped /usr/src/linux/include on a current SLES11 SP3 (and do bear in mind SuSE patches their kernels heavily so the 3.0.101 has interfaces probably similar to 3.6 vanilla) shows no 'HAVE_MOUNT_*' strings.

The only thing in the region of that was:

$ grep -Ri MOUNT_NODEV *
linux/fs.h:extern struct dentry *mount_nodev(struct file_system_type *fs_type,

it's defined as:

extern struct dentry *mount_nodev(struct file_system_type *fs_type,
        int flags, void *data,
        int (*fill_super)(struct super_block *, void *, int));

There's also:

#define MNT_NODEV       0x02

in linux/mount.h.

Just in case, I've put the src.rpm for the stock SLES11 SP3 kernel source at https://anorien.csc.warwick.ac.uk/kernel-source-3.0.76-0.11.1.x86_64.rpm - it will produce the /usr/src/linux used for building on SLES.

Hope this helps anyway, don't hesitate to ask if you need more information.
(edit: updated rpm url)

@FransUrbo
Copy link
Contributor

@andrey-ve Any update on this?

I've replaced path_lookup() with spl_kern_path_parent() to make it build on my latest GIT (very-soon-to-be-0.6.3) and a 3.2.0 kernel and got a stack trace that looked very much like the one @jzachwieja got above.

@FransUrbo
Copy link
Contributor

Adding some printk()'s (don't know a better way to debug a kernel module :), I found this:

From syslog:

DebianZFS-Wheezy-SCST2:/usr/src/zfs# dmesg | grep ZFS:
[    4.992083] ZFS: Loaded module v0.6.2-305_g04274d8, ZFS pool version 5000, ZFS filesystem version 5
[   45.521739] ZFS: zfsctl_lookup_snapshot_path() - init/calling zfsctl_get_mnt_path()
[   45.521743] ZFS: zfsctl_get_mnt_path()
[   45.521745] ZFS: zfsctl_get_mnt_path() - 2
[   45.521746] ZFS: zfsctl_get_mnt_path() - 3
DebianZFS-Wheezy-SCST2:/usr/src/zfs# 

This corresponds to the code:

        printk("ZFS: zfsctl_get_mnt_path() - 2\n");
        path.mnt = zsb->z_mnt;
        printk("ZFS: zfsctl_get_mnt_path() - 3\n");
        path.dentry = zsb->z_mnt->mnt_root;
        printk("ZFS: zfsctl_get_mnt_path() - calling zfsctl_snapshot_zpath()\n");

@FransUrbo
Copy link
Contributor

I DO have the HAVE_MOUNT_NODEV, so it seems that z_mnt isn't set (the only reference I could find where it is, is from your zpl_get_sb() function).

@FransUrbo
Copy link
Contributor

Since I have MOUNT_NODEV, my code calls zpl_mount(), which doesn't set z_mnt.

But since mount_nodev() returns a struct dentry *, we could use that for z_mnt - which we need for path.dentry (the part that currently fails).

No idea how to get to a struct vfsmount * though (which we would need for path.mnt in zfsctl_get_mnt_path())!

@andrey-ve
Copy link
Contributor Author

@FransUrbo

I have already invested some time research: how to get struct vfsmount * when HAVE_MOUNT_NODEV enabled. As far as I can understand it's not intended by design to provide access to struct vfsmount * from with file system itself.

The one of not HACK solutions is to do the same thing as user space does to get
the mnt path stored inside dataset. Take a look at case ZFS_PROP_MOUNTPOINT: line in zfs_prop_get function, the code below builds needed mount path. If mount path related code inside
zfs_prop_get could be ported to kernel space then getting struct vfsmount * completely unnecessary.

Unfortunately I don't have a time right now an in near future to address this issue.

@andrey-ve
Copy link
Contributor Author

@jzachwieja - sorry for taking so long to respond.

Take a look at 2 latest posts by @FransUrbo: as I can understand we can't get struct vfsmount * in your kernel version. My previous post describes a solution.

@FransUrbo
Copy link
Contributor

Unfortunately, I don't seem to have the necessary skills to do this, it's way to close to the core for my liking... So we have to wait for someone else to step up and take a crack at this.

@ghost
Copy link

ghost commented Jun 8, 2014

@andrey-ve

Thank you for the reply, I'll get the path construct into the kernel module and see how we get on with that.

@andrey-ve
Copy link
Contributor Author

@jzachwieja: great, let me know if you have questions or need help.

@behlendorf
Copy link
Contributor

@andrey-ve could you please refresh this patch against the latest master. This will cause the buildbot to pick it up for automated testing and we can see what kind of kernel compatibility problems there still are.

@yshui
Copy link
Contributor

yshui commented Sep 11, 2014

Will this patch also fix the EIO returned by mkdir()?

@yshui
Copy link
Contributor

yshui commented Sep 16, 2014

I tried to adopt this patch to latest master. the compatibility issue seems easy to fix. I'm not so sure about the kernel panic one.

@behlendorf
Copy link
Contributor

Closing is favor of #2797.

@behlendorf behlendorf closed this Oct 23, 2014
@behlendorf behlendorf modified the milestone: 0.6.5 Nov 8, 2014
behlendorf added a commit to behlendorf/zfs that referenced this pull request Sep 3, 2015
This patch is based on the previous work done by @andrey-ve and
@yshui.  It triggers the automount by using kern_path() to traverse
to the known snapshout mount point.  Once the snapshot is mounted
NFS can access the contents of the snapshot.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#2797
Issue openzfs#1655
Issue openzfs#616
behlendorf added a commit to behlendorf/zfs that referenced this pull request Sep 4, 2015
This patch is based on the previous work done by @andrey-ve and
@yshui.  It triggers the automount by using kern_path() to traverse
to the known snapshout mount point.  Once the snapshot is mounted
NFS can access the contents of the snapshot.

Allowing NFS clients to access to the .zfs/snapshot directory would
normally mean that a root user on a client mounting an export with
'no_root_squash' would be able to use mkdir/rmdir/mv to manipulate
snapshots on the server.  To prevent configuration mistakes a
zfs_admin_snapshot module option was added which disables the
mkdir/rmdir/mv functionally.  System administators desiring this
functionally must explicitly enable it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#2797
Issue openzfs#1655
Issue openzfs#616
behlendorf added a commit to behlendorf/zfs that referenced this pull request Sep 4, 2015
This patch is based on the previous work done by @andrey-ve and
@yshui.  It triggers the automount by using kern_path() to traverse
to the known snapshout mount point.  Once the snapshot is mounted
NFS can access the contents of the snapshot.

Allowing NFS clients to access to the .zfs/snapshot directory would
normally mean that a root user on a client mounting an export with
'no_root_squash' would be able to use mkdir/rmdir/mv to manipulate
snapshots on the server.  To prevent configuration mistakes a
zfs_admin_snapshot module option was added which disables the
mkdir/rmdir/mv functionally.  System administators desiring this
functionally must explicitly enable it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#2797
Closes openzfs#1655
Closes openzfs#616
tomgarcia pushed a commit to tomgarcia/zfs that referenced this pull request Sep 11, 2015
This patch is based on the previous work done by @andrey-ve and
@yshui.  It triggers the automount by using kern_path() to traverse
to the known snapshout mount point.  Once the snapshot is mounted
NFS can access the contents of the snapshot.

Allowing NFS clients to access to the .zfs/snapshot directory would
normally mean that a root user on a client mounting an export with
'no_root_squash' would be able to use mkdir/rmdir/mv to manipulate
snapshots on the server.  To prevent configuration mistakes a
zfs_admin_snapshot module option was added which disables the
mkdir/rmdir/mv functionally.  System administators desiring this
functionally must explicitly enable it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#2797
Closes openzfs#1655
Closes openzfs#616
ryao pushed a commit to ClusterHQ/zfs that referenced this pull request Sep 16, 2015
This patch is based on the previous work done by @andrey-ve and
@yshui.  It triggers the automount by using kern_path() to traverse
to the known snapshout mount point.  Once the snapshot is mounted
NFS can access the contents of the snapshot.

Allowing NFS clients to access to the .zfs/snapshot directory would
normally mean that a root user on a client mounting an export with
'no_root_squash' would be able to use mkdir/rmdir/mv to manipulate
snapshots on the server.  To prevent configuration mistakes a
zfs_admin_snapshot module option was added which disables the
mkdir/rmdir/mv functionally.  System administators desiring this
functionally must explicitly enable it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#2797
Closes openzfs#1655
Closes openzfs#616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support .zfs/snapshot access via NFS
8 participants