Update vdev state for spare vdev
zfsd fetches new pool configuration through ZFS_IOC_POOL_STATS but it does not get updated nvlist configuration for spare vdev since the configuration is read by spa_spares->sav_config. In this commit, updating the vdev state for spare vdev that is consumed by zfsd on spare disk hotplug. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ameer Hamza <ahamza@ixsystems.com> Closes #14653
This commit is contained in:
parent
0ad5f43442
commit
a05263b7aa
@ -5393,13 +5393,15 @@ spa_add_spares(spa_t *spa, nvlist_t *config)
|
||||
for (i = 0; i < nspares; i++) {
|
||||
guid = fnvlist_lookup_uint64(spares[i],
|
||||
ZPOOL_CONFIG_GUID);
|
||||
VERIFY0(nvlist_lookup_uint64_array(spares[i],
|
||||
ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &vsc));
|
||||
if (spa_spare_exists(guid, &pool, NULL) &&
|
||||
pool != 0ULL) {
|
||||
VERIFY0(nvlist_lookup_uint64_array(spares[i],
|
||||
ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs,
|
||||
&vsc));
|
||||
vs->vs_state = VDEV_STATE_CANT_OPEN;
|
||||
vs->vs_aux = VDEV_AUX_SPARED;
|
||||
} else {
|
||||
vs->vs_state =
|
||||
spa->spa_spares.sav_vdevs[i]->vdev_state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user