summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorGeorge Wilson <[email protected]>2020-08-11 14:55:04 -0600
committerGitHub <[email protected]>2020-08-11 13:55:04 -0700
commit53c9d1d9b5ff19d3095f9dcbb806582d9c0b977f (patch)
tree45e23eead2953b19d3ccf60159402d8623d09f4d /cmd
parent6f763d408530c5dd22e4e8616235871524e55529 (diff)
'zfs share -a' should handle 'canmount=noauto'
The 'zfs share -a' currently skips any filesystems which have 'canmount=noauto' set. This behavior is unexpected since the one would expect 'zfs share -a' to share any mounted filesystem that has the 'sharenfs' property already set. This changes the behavior of 'zfs share -a' to allow the sharing of 'canmount=noauto' datasets if they are mounted. Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Don Brady <[email protected]> Reviewed-by: Prakash Surya <[email protected]> Signed-off-by: George Wilson <[email protected]> External-issue: DLPX-71313 Closes #10688
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index c6a29095e..2878f03a3 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -6627,7 +6627,15 @@ share_mount_one(zfs_handle_t *zhp, int op, int flags, char *protocol,
zfs_get_name(zhp));
return (1);
} else if (canmount == ZFS_CANMOUNT_NOAUTO && !explicit) {
- return (0);
+ /*
+ * When performing a 'zfs mount -a', we skip any mounts for
+ * datasets that have 'noauto' set. Sharing a dataset with
+ * 'noauto' set is only allowed if it's mounted.
+ */
+ if (op == OP_MOUNT)
+ return (0);
+ if (op == OP_SHARE && !zfs_is_mounted(zhp, NULL))
+ return (0);
}
/*