From b87baa7ed2374bf8138f2c9f6b260498c0252eb6 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Mon, 23 Jan 2017 22:13:15 +0300 Subject: OpenZFS 6428 - set canmount=off on unmounted filesystem tries to unmount children Authored by: Andriy Gapon Reviewed by: Matthew Ahrens Approved by: Gordon Ross Reviewed-by: Brian Behlendorf Reviewed-by: Giuseppe Di Natale Ported-by: George Melikov OpenZFS-issue: https://www.illumos.org/issues/6428 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c079fa4 Closes #5628 --- lib/libzfs/libzfs_dataset.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index d4f016660..240728f96 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1628,8 +1628,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