svn commit: r308989 - vendor/illumos/dist/lib/libzfs/common

Andriy Gapon avg at FreeBSD.org
Tue Nov 22 11:50:54 UTC 2016


Author: avg
Date: Tue Nov 22 11:50:52 2016
New Revision: 308989
URL: https://svnweb.freebsd.org/changeset/base/308989

Log:
  6428 set canmount=off on unmounted filesystem tries to unmount children
  
  illumos/illumos-gate at c079fa4d202eff15e318131c52755d214ffa2da7
  https://github.com/illumos/illumos-gate/commit/c079fa4d202eff15e318131c52755d214ffa2da7
  
  https://www.illumos.org/issues/6428
    Scenario:
    $ zfs create rpool/p
    $ zfs set canmount=noauto rpool/p
    $ zfs umount rpool/p
    $ zfs create rpool/p/c
    $ zfs get -r mounted,canmount rpool/p
    NAME             PROPERTY  VALUE     SOURCE
    rpool/p    mounted   no        -
    rpool/p    canmount  noauto    local
    rpool/p/c  mounted   yes       -
    rpool/p/c  canmount  on        default
    In another shell ensure that rpool/p/c is in use, for example:
    $ cd /rpool/p/c
    Then:
    $ zfs set canmount=off rpool/p
    cannot unmount '/rpool/p/c': Device busy
    But there is no reason to try to unmount rpool/p/c in this scenario.
  
  Reviewed by: Matthew Ahrens <mahrens at delphix.com>
  Approved by: Gordon Ross <gordon.w.ross at gmail.com>
  Author: Andriy Gapon <andriy.gapon at clusterhq.com>

Modified:
  vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c

Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Tue Nov 22 11:49:55 2016	(r308988)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c	Tue Nov 22 11:50:52 2016	(r308989)
@@ -1597,8 +1597,9 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl
 		 * 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;


More information about the svn-src-all mailing list