From 62c5782de89746d8806848eff3faa835be506b7f Mon Sep 17 00:00:00 2001 From: avg Date: Tue, 6 Sep 2016 06:17:39 +0000 Subject: [PATCH] MFC r304520: fix bug introduced in r297521, set canmount=on doesn't mount filesystem git-svn-id: svn://svn.freebsd.org/base/stable/10@305461 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- .../opensolaris/lib/libzfs/common/libzfs_dataset.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c index 5628ba2be..a53e2fb8f 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c @@ -1624,12 +1624,17 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) assert(cl_idx < nvl_len); /* * We don't want to unmount & remount the dataset when changing - * its canmount property to 'on' or 'noauto'. We only use - * the changelist logic to unmount when setting canmount=off. + * its canmount property. We only use the changelist logic to + * unmount when setting canmount=off for a mounted filesystem + * or when setting canmount=on for an unmounted filesystem. + * For all other changes to canmount property the filesystem + * remains the same. */ if (prop != ZFS_PROP_CANMOUNT || (fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF && - zfs_is_mounted(zhp, NULL))) { + zfs_is_mounted(zhp, NULL)) || + (fnvpair_value_uint64(elem) == ZFS_CANMOUNT_ON && + !zfs_is_mounted(zhp, NULL))) { cls[cl_idx] = changelist_gather(zhp, prop, 0, 0); if (cls[cl_idx] == NULL) goto error; -- 2.45.0