Print this page
3956 ::vdev -r should work with pipelines
3957 ztest should update the cachefile before killing itself
3958 multiple scans can lead to partial resilvering
3959 ddt entries are not always resilvered
3960 dsl_scan can skip over dedup-ed blocks if physical birth != logical birth
3961 freed gang blocks are not resilvered and can cause pool to suspend
3962 ztest should print out zfs debug buffer before exiting
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
*** 214,247 ****
vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
vdev_config_flag_t flags)
{
nvlist_t *nv = NULL;
! VERIFY(nvlist_alloc(&nv, NV_UNIQUE_NAME, KM_SLEEP) == 0);
! VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_TYPE,
! vd->vdev_ops->vdev_op_type) == 0);
if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)))
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ID, vd->vdev_id)
! == 0);
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_GUID, vd->vdev_guid) == 0);
if (vd->vdev_path != NULL)
! VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_PATH,
! vd->vdev_path) == 0);
if (vd->vdev_devid != NULL)
! VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_DEVID,
! vd->vdev_devid) == 0);
if (vd->vdev_physpath != NULL)
! VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_PHYS_PATH,
! vd->vdev_physpath) == 0);
if (vd->vdev_fru != NULL)
! VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_FRU,
! vd->vdev_fru) == 0);
if (vd->vdev_nparity != 0) {
ASSERT(strcmp(vd->vdev_ops->vdev_op_type,
VDEV_TYPE_RAIDZ) == 0);
--- 214,242 ----
vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats,
vdev_config_flag_t flags)
{
nvlist_t *nv = NULL;
! nv = fnvlist_alloc();
! fnvlist_add_string(nv, ZPOOL_CONFIG_TYPE, vd->vdev_ops->vdev_op_type);
if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)))
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_ID, vd->vdev_id);
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_GUID, vd->vdev_guid);
if (vd->vdev_path != NULL)
! fnvlist_add_string(nv, ZPOOL_CONFIG_PATH, vd->vdev_path);
if (vd->vdev_devid != NULL)
! fnvlist_add_string(nv, ZPOOL_CONFIG_DEVID, vd->vdev_devid);
if (vd->vdev_physpath != NULL)
! fnvlist_add_string(nv, ZPOOL_CONFIG_PHYS_PATH,
! vd->vdev_physpath);
if (vd->vdev_fru != NULL)
! fnvlist_add_string(nv, ZPOOL_CONFIG_FRU, vd->vdev_fru);
if (vd->vdev_nparity != 0) {
ASSERT(strcmp(vd->vdev_ops->vdev_op_type,
VDEV_TYPE_RAIDZ) == 0);
*** 258,320 ****
/*
* Note that we'll add the nparity tag even on storage pools
* that only support a single parity device -- older software
* will just ignore it.
*/
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_NPARITY,
! vd->vdev_nparity) == 0);
}
if (vd->vdev_wholedisk != -1ULL)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
! vd->vdev_wholedisk) == 0);
if (vd->vdev_not_present)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1) == 0);
if (vd->vdev_isspare)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1) == 0);
if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
vd == vd->vdev_top) {
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
! vd->vdev_ms_array) == 0);
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
! vd->vdev_ms_shift) == 0);
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
! vd->vdev_ashift) == 0);
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
! vd->vdev_asize) == 0);
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,
! vd->vdev_islog) == 0);
if (vd->vdev_removing)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
! vd->vdev_removing) == 0);
}
if (vd->vdev_dtl_smo.smo_object != 0)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
! vd->vdev_dtl_smo.smo_object) == 0);
if (vd->vdev_crtxg)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG,
! vd->vdev_crtxg) == 0);
if (getstats) {
vdev_stat_t vs;
pool_scan_stat_t ps;
vdev_get_stats(vd, &vs);
! VERIFY(nvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
! (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t)) == 0);
/* provide either current or previous scan information */
if (spa_scan_get_stats(spa, &ps) == 0) {
! VERIFY(nvlist_add_uint64_array(nv,
ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,
! sizeof (pool_scan_stat_t) / sizeof (uint64_t))
! == 0);
}
}
if (!vd->vdev_ops->vdev_op_leaf) {
nvlist_t **child;
--- 253,310 ----
/*
* Note that we'll add the nparity tag even on storage pools
* that only support a single parity device -- older software
* will just ignore it.
*/
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_NPARITY, vd->vdev_nparity);
}
if (vd->vdev_wholedisk != -1ULL)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_WHOLE_DISK,
! vd->vdev_wholedisk);
if (vd->vdev_not_present)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, 1);
if (vd->vdev_isspare)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_SPARE, 1);
if (!(flags & (VDEV_CONFIG_SPARE | VDEV_CONFIG_L2CACHE)) &&
vd == vd->vdev_top) {
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_ARRAY,
! vd->vdev_ms_array);
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
! vd->vdev_ms_shift);
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT, vd->vdev_ashift);
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
! vd->vdev_asize);
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG, vd->vdev_islog);
if (vd->vdev_removing)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING,
! vd->vdev_removing);
}
if (vd->vdev_dtl_smo.smo_object != 0)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_DTL,
! vd->vdev_dtl_smo.smo_object);
if (vd->vdev_crtxg)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_CREATE_TXG, vd->vdev_crtxg);
if (getstats) {
vdev_stat_t vs;
pool_scan_stat_t ps;
vdev_get_stats(vd, &vs);
! fnvlist_add_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
! (uint64_t *)&vs, sizeof (vs) / sizeof (uint64_t));
/* provide either current or previous scan information */
if (spa_scan_get_stats(spa, &ps) == 0) {
! fnvlist_add_uint64_array(nv,
ZPOOL_CONFIG_SCAN_STATS, (uint64_t *)&ps,
! sizeof (pool_scan_stat_t) / sizeof (uint64_t));
}
}
if (!vd->vdev_ops->vdev_op_leaf) {
nvlist_t **child;
*** 340,351 ****
child[idx++] = vdev_config_generate(spa, cvd,
getstats, flags);
}
if (idx) {
! VERIFY(nvlist_add_nvlist_array(nv,
! ZPOOL_CONFIG_CHILDREN, child, idx) == 0);
}
for (c = 0; c < idx; c++)
nvlist_free(child[c]);
--- 330,341 ----
child[idx++] = vdev_config_generate(spa, cvd,
getstats, flags);
}
if (idx) {
! fnvlist_add_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
! child, idx);
}
for (c = 0; c < idx; c++)
nvlist_free(child[c]);
*** 353,382 ****
} else {
const char *aux = NULL;
if (vd->vdev_offline && !vd->vdev_tmpoffline)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_OFFLINE,
! B_TRUE) == 0);
! if (vd->vdev_resilvering)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_RESILVERING,
! B_TRUE) == 0);
if (vd->vdev_faulted)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_FAULTED,
! B_TRUE) == 0);
if (vd->vdev_degraded)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_DEGRADED,
! B_TRUE) == 0);
if (vd->vdev_removed)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVED,
! B_TRUE) == 0);
if (vd->vdev_unspare)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_UNSPARE,
! B_TRUE) == 0);
if (vd->vdev_ishole)
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_HOLE,
! B_TRUE) == 0);
switch (vd->vdev_stat.vs_aux) {
case VDEV_AUX_ERR_EXCEEDED:
aux = "err_exceeded";
break;
--- 343,366 ----
} else {
const char *aux = NULL;
if (vd->vdev_offline && !vd->vdev_tmpoffline)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_OFFLINE, B_TRUE);
! if (vd->vdev_resilver_txg != 0)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_RESILVER_TXG,
! vd->vdev_resilver_txg);
if (vd->vdev_faulted)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_FAULTED, B_TRUE);
if (vd->vdev_degraded)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_DEGRADED, B_TRUE);
if (vd->vdev_removed)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVED, B_TRUE);
if (vd->vdev_unspare)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_UNSPARE, B_TRUE);
if (vd->vdev_ishole)
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_IS_HOLE, B_TRUE);
switch (vd->vdev_stat.vs_aux) {
case VDEV_AUX_ERR_EXCEEDED:
aux = "err_exceeded";
break;
*** 385,400 ****
aux = "external";
break;
}
if (aux != NULL)
! VERIFY(nvlist_add_string(nv, ZPOOL_CONFIG_AUX_STATE,
! aux) == 0);
if (vd->vdev_splitting && vd->vdev_orig_guid != 0LL) {
! VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ORIG_GUID,
! vd->vdev_orig_guid) == 0);
}
}
return (nv);
}
--- 369,383 ----
aux = "external";
break;
}
if (aux != NULL)
! fnvlist_add_string(nv, ZPOOL_CONFIG_AUX_STATE, aux);
if (vd->vdev_splitting && vd->vdev_orig_guid != 0LL) {
! fnvlist_add_uint64(nv, ZPOOL_CONFIG_ORIG_GUID,
! vd->vdev_orig_guid);
}
}
return (nv);
}