svn commit: r316900 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

Andriy Gapon avg at FreeBSD.org
Fri Apr 14 18:13:08 UTC 2017


Author: avg
Date: Fri Apr 14 18:13:06 2017
New Revision: 316900
URL: https://svnweb.freebsd.org/changeset/base/316900

Log:
  7743 per-vdev-zaps have no initialize path on upgrade
  
  illumos/illumos-gate at 555da5111b0f2552c42d057b211aba89c9c79f6c
  https://github.com/illumos/illumos-gate/commit/555da5111b0f2552c42d057b211aba89c9c79f6c
  
  https://www.illumos.org/issues/7743
    When loading a pool that had been created before the existance of
    per-vdev zaps, on a system that knows about per-vdev zaps, the
    per-vdev zaps will not be allocated and initialized.
    This appears to be because the logic that would have done so, in
    spa_sync_config_object(), is not reached under normal operation. It is
    only reached if spa_config_dirty_list is non-empty.
    The fix is to add another `AVZ_ACTION_` enum that will allow this code
    to be reached when we detect that we're loading an old pool, even when
    there are no dirty configs.
  
  Reviewed by: Matt Ahrens <mahrens at delphix.com>
  Reviewed by: Pavel Zakharov <pavel.zakharov at delphix.com>
  Reviewed by: George Wilson <george.wilson at delphix.com>
  Reviewed by: Don Brady <don.brady at intel.com>
  Approved by: Robert Mustacchi <rm at joyent.com>
  Author: Paul Dagnelie <pcd at delphix.com>

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c	Fri Apr 14 18:11:53 2017	(r316899)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/spa.c	Fri Apr 14 18:13:06 2017	(r316900)
@@ -2657,10 +2657,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_
 	error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP,
 	    &spa->spa_all_vdev_zaps);
 
-	if (error != ENOENT && error != 0) {
+	if (error == ENOENT) {
+		VERIFY(!nvlist_exists(mos_config,
+		    ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS));
+		spa->spa_avz_action = AVZ_ACTION_INITIALIZE;
+		ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev));
+	} else if (error != 0) {
 		return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
-	} else if (error == 0 && !nvlist_exists(mos_config,
-	    ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
+	} else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
 		/*
 		 * An older version of ZFS overwrote the sentinel value, so
 		 * we have orphaned per-vdev ZAPs in the MOS. Defer their
@@ -6156,6 +6160,7 @@ spa_sync_config_object(spa_t *spa, dmu_t
 	spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
 
 	ASSERT(spa->spa_avz_action == AVZ_ACTION_NONE ||
+	    spa->spa_avz_action == AVZ_ACTION_INITIALIZE ||
 	    spa->spa_all_vdev_zaps != 0);
 
 	if (spa->spa_avz_action == AVZ_ACTION_REBUILD) {

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h
==============================================================================
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h	Fri Apr 14 18:11:53 2017	(r316899)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/spa_impl.h	Fri Apr 14 18:13:06 2017	(r316900)
@@ -119,7 +119,8 @@ typedef struct spa_taskqs {
 typedef enum spa_all_vdev_zap_action {
 	AVZ_ACTION_NONE = 0,
 	AVZ_ACTION_DESTROY,	/* Destroy all per-vdev ZAPs and the AVZ. */
-	AVZ_ACTION_REBUILD	/* Populate the new AVZ, see spa_avz_rebuild */
+	AVZ_ACTION_REBUILD,	/* Populate the new AVZ, see spa_avz_rebuild */
+	AVZ_ACTION_INITIALIZE
 } spa_avz_action_t;
 
 struct spa {


More information about the svn-src-all mailing list