Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Oct 2016 16:49:16 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r307055 - in stable/10/sys/cddl/contrib/opensolaris/uts/common: fs/zfs sys/sysevent
Message-ID:  <201610111649.u9BGnGTv022547@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Oct 11 16:49:16 2016
New Revision: 307055
URL: https://svnweb.freebsd.org/changeset/base/307055

Log:
  MFC r305198: MFV r302647:
  6922 Emit ESC_ZFS_VDEV_REMOVE_AUX after removing an aux device
  
  illumos/illumos-gate@63364b0ee2604783e7a55f8425888867768eafa4
  https://github.com/illumos/illumos-gate/commit/63364b0ee2604783e7a55f84258888677
  68eafa4
  
  https://www.illumos.org/issues/6922
    ZFS does not do a config_sync after removing an aux (spare, log, or cache)
    device. AFAICT this isn't being done because it is slow and was deemed
    unnecessary. However, it should be such a rare operation that speed doesn't
    matter, and not doing it results in two problems:
    1) It is theoretically possible to remove an aux device from one pool and
    attach it to another, then lose power. When power is restored, both pools woul
  d
    think that they own the aux device.
    2) Removal of the aux device doesn't send any useful sysevents to userland.
  
  Reviewed by: George Wilson <george.wilson@delphix.com>
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Approved by: Dan McDonald <danmcd@omniti.com>
  Author: Alan Somers <asomers@gmail.com>

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Tue Oct 11 16:48:12 2016	(r307054)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c	Tue Oct 11 16:49:16 2016	(r307055)
@@ -5680,6 +5680,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 		} else {
 			error = SET_ERROR(EBUSY);
 		}
+		spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
 	} else if (spa->spa_l2cache.sav_vdevs != NULL &&
 	    nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
 	    ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0 &&
@@ -5691,6 +5692,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 		    ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
 		spa_load_l2cache(spa);
 		spa->spa_l2cache.sav_sync = B_TRUE;
+		spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
 	} else if (vd != NULL && vd->vdev_islog) {
 		ASSERT(!locked);
 		ASSERT(vd == vd->vdev_top);
@@ -5729,6 +5731,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 		 */
 		spa_vdev_remove_from_namespace(spa, vd);
 
+		spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
 	} else if (vd != NULL) {
 		/*
 		 * Normal vdevs cannot be removed (yet).
@@ -5742,7 +5745,7 @@ spa_vdev_remove(spa_t *spa, uint64_t gui
 	}
 
 	if (!locked)
-		return (spa_vdev_exit(spa, NULL, txg, error));
+		error = spa_vdev_exit(spa, NULL, txg, error);
 
 	return (error);
 }

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h	Tue Oct 11 16:48:12 2016	(r307054)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h	Tue Oct 11 16:49:16 2016	(r307055)
@@ -249,6 +249,8 @@ extern "C" {
 #define	ESC_ZFS_RESILVER_START		"ESC_ZFS_resilver_start"
 #define	ESC_ZFS_RESILVER_FINISH		"ESC_ZFS_resilver_finish"
 #define	ESC_ZFS_VDEV_REMOVE		"ESC_ZFS_vdev_remove"
+#define	ESC_ZFS_VDEV_REMOVE_AUX		"ESC_ZFS_vdev_remove_aux"
+#define	ESC_ZFS_VDEV_REMOVE_DEV		"ESC_ZFS_vdev_remove_dev"
 #define	ESC_ZFS_POOL_CREATE		"ESC_ZFS_pool_create"
 #define	ESC_ZFS_POOL_DESTROY		"ESC_ZFS_pool_destroy"
 #define	ESC_ZFS_POOL_IMPORT		"ESC_ZFS_pool_import"



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