/* create the mountpoint if necessary */
if (ret == 0) {
zfs_handle_t *clone;
+ int canmount = ZFS_CANMOUNT_OFF;
if (log_history) {
(void) zpool_log_history(g_zfs, history_str);
clone = zfs_open(g_zfs, argv[1], ZFS_TYPE_DATASET);
if (clone != NULL) {
- if (zfs_get_type(clone) != ZFS_TYPE_VOLUME)
+ /*
+ * if the user doesn't want the dataset automatically
+ * mounted, then skip the mount/share step.
+ */
+ if (zfs_prop_valid_for_type(ZFS_PROP_CANMOUNT,
+ zfs_get_type(clone), B_FALSE))
+ canmount = zfs_prop_get_int(clone,
+ ZFS_PROP_CANMOUNT);
+
+ if (zfs_get_type(clone) != ZFS_TYPE_VOLUME &&
+ canmount == ZFS_CANMOUNT_ON)
if ((ret = zfs_mount(clone, NULL, 0)) == 0)
ret = zfs_share(clone);
zfs_close(clone);