Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Nov 2016 11:50:52 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r308989 - vendor/illumos/dist/lib/libzfs/common
Message-ID:  <201611221150.uAMBoqJg013246@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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@delphix.com>
  Approved by: Gordon Ross <gordon.w.ross@gmail.com>
  Author: Andriy Gapon <andriy.gapon@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611221150.uAMBoqJg013246>