From c079fa4d202eff15e318131c52755d214ffa2da7 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Mon, 21 Nov 2016 15:29:36 -0800 Subject: 6428 set canmount=off on unmounted filesystem tries to unmount children Reviewed by: Matthew Ahrens Approved by: Gordon Ross --- usr/src/lib/libzfs/common/libzfs_dataset.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'usr/src') diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c index 4200f49cca..32a8dbf682 100644 --- a/usr/src/lib/libzfs/common/libzfs_dataset.c +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c @@ -1689,8 +1689,9 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvlist_t *props) * its canmount property to 'on' or 'noauto'. We only use * the changelist logic to unmount when setting canmount=off. */ - if (!(prop == ZFS_PROP_CANMOUNT && - fnvpair_value_uint64(elem) != ZFS_CANMOUNT_OFF)) { + if (prop != ZFS_PROP_CANMOUNT || + (fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF && + zfs_is_mounted(zhp, NULL))) { cls[cl_idx] = changelist_gather(zhp, prop, 0, 0); if (cls[cl_idx] == NULL) goto error; -- cgit v1.2.3