fix zfs set canmount=off on an unmounted filesystem

Previously this operation tried to unmount and remount children.
Also see https://www.illumos.org/issues/6428.

MFC after:	2 weeks
X-Needs-Upstreaming:	illumos
This commit is contained in:
Andriy Gapon 2016-04-03 07:42:13 +00:00
parent 34082fa0f8
commit 329e9bafe4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297521

View File

@ -1633,8 +1633,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;