Skip to content
This repository was archived by the owner on Nov 7, 2019. It is now read-only.

Commit e2d29d0

Browse files
pcd1193182ahrens
authored andcommitted
7743 per-vdev-zaps have no initialize path on upgrade
Reviewed by: Matt Ahrens <mahrens@delphix.com> Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Don Brady <don.brady@intel.com> 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. Closes #272
1 parent 5703996 commit e2d29d0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

usr/src/uts/common/fs/zfs/spa.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,10 +2657,14 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
26572657
error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP,
26582658
&spa->spa_all_vdev_zaps);
26592659

2660-
if (error != ENOENT && error != 0) {
2660+
if (error == ENOENT) {
2661+
VERIFY(!nvlist_exists(mos_config,
2662+
ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS));
2663+
spa->spa_avz_action = AVZ_ACTION_INITIALIZE;
2664+
ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev));
2665+
} else if (error != 0) {
26612666
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2662-
} else if (error == 0 && !nvlist_exists(mos_config,
2663-
ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
2667+
} else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
26642668
/*
26652669
* An older version of ZFS overwrote the sentinel value, so
26662670
* we have orphaned per-vdev ZAPs in the MOS. Defer their
@@ -6156,6 +6160,7 @@ spa_sync_config_object(spa_t *spa, dmu_tx_t *tx)
61566160
spa_config_enter(spa, SCL_STATE, FTAG, RW_READER);
61576161

61586162
ASSERT(spa->spa_avz_action == AVZ_ACTION_NONE ||
6163+
spa->spa_avz_action == AVZ_ACTION_INITIALIZE ||
61596164
spa->spa_all_vdev_zaps != 0);
61606165

61616166
if (spa->spa_avz_action == AVZ_ACTION_REBUILD) {

usr/src/uts/common/fs/zfs/sys/spa_impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ typedef struct spa_taskqs {
119119
typedef enum spa_all_vdev_zap_action {
120120
AVZ_ACTION_NONE = 0,
121121
AVZ_ACTION_DESTROY, /* Destroy all per-vdev ZAPs and the AVZ. */
122-
AVZ_ACTION_REBUILD /* Populate the new AVZ, see spa_avz_rebuild */
122+
AVZ_ACTION_REBUILD, /* Populate the new AVZ, see spa_avz_rebuild */
123+
AVZ_ACTION_INITIALIZE
123124
} spa_avz_action_t;
124125

125126
struct spa {

0 commit comments

Comments
 (0)