aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/lib
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2016-08-20 09:12:01 +0000
committerAndriy Gapon <avg@FreeBSD.org>2016-08-20 09:12:01 +0000
commit723af0425e78ca741b56dcb333aa227c969a2e33 (patch)
treed78a5154e21ebda912c5eef449501b0a88aa765d /cddl/contrib/opensolaris/lib
parentbeacb098647c40dd6665f31a6cc6152af2c59557 (diff)
downloadsrc-723af0425e78ca741b56dcb333aa227c969a2e33.tar.gz
src-723af0425e78ca741b56dcb333aa227c969a2e33.zip
fix bug introduced in r297521, set canmount=on doesn't mount filesystem
There are two cases where changing canmount should result in an action: - canmount is set to off for a mounted filesystem - canmount is set to on for an unmounted filesystem Before r297521 we could unmount and re-mount a filesystem when that was not necessary, but after r297521 we only handled the first of the above cases. MFC after: 5 days
Notes
Notes: svn path=/head/; revision=304520
Diffstat (limited to 'cddl/contrib/opensolaris/lib')
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c11
1 files 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 dbafaa99c276..5babb7b3196d 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
@@ -1630,12 +1630,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;