mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
OpenZFS 7136 - ESC_VDEV_REMOVE_AUX ought to always include vdev information
Authored by: Alan Somers <asomers@gmail.com> 7115 6922 generates ESC_ZFS_VDEV_REMOVE_AUX a bit too often Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> Approved by: Robert Mustacchi <rm@joyent.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Ported-by: George Melikov <mail@gmelikov.ru> OpenZFS-issue: https://www.illumos.org/issues/7136 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/b72b6bb Closes #5691 Porting notes: - Functionally this patch behaves the same as the OpenZFS version but it was adapted because because ZoL doesn't have the same illumos sysevent_t infrastructure and functionality.
This commit is contained in:
parent
ed828c0c37
commit
6325e48f95
@ -5476,6 +5476,9 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
|
|||||||
* in this pool.
|
* in this pool.
|
||||||
*/
|
*/
|
||||||
if (vd == NULL || unspare) {
|
if (vd == NULL || unspare) {
|
||||||
|
if (vd == NULL)
|
||||||
|
vd = spa_lookup_by_guid(spa, guid, B_TRUE);
|
||||||
|
spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
|
||||||
spa_vdev_remove_aux(spa->spa_spares.sav_config,
|
spa_vdev_remove_aux(spa->spa_spares.sav_config,
|
||||||
ZPOOL_CONFIG_SPARES, spares, nspares, nv);
|
ZPOOL_CONFIG_SPARES, spares, nspares, nv);
|
||||||
spa_load_spares(spa);
|
spa_load_spares(spa);
|
||||||
@ -5483,7 +5486,6 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
|
|||||||
} else {
|
} else {
|
||||||
error = SET_ERROR(EBUSY);
|
error = SET_ERROR(EBUSY);
|
||||||
}
|
}
|
||||||
spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
|
|
||||||
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
|
} else if (spa->spa_l2cache.sav_vdevs != NULL &&
|
||||||
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
|
nvlist_lookup_nvlist_array(spa->spa_l2cache.sav_config,
|
||||||
ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0 &&
|
ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0 &&
|
||||||
@ -5491,11 +5493,12 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
|
|||||||
/*
|
/*
|
||||||
* Cache devices can always be removed.
|
* Cache devices can always be removed.
|
||||||
*/
|
*/
|
||||||
|
vd = spa_lookup_by_guid(spa, guid, B_TRUE);
|
||||||
|
spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
|
||||||
spa_vdev_remove_aux(spa->spa_l2cache.sav_config,
|
spa_vdev_remove_aux(spa->spa_l2cache.sav_config,
|
||||||
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
|
ZPOOL_CONFIG_L2CACHE, l2cache, nl2cache, nv);
|
||||||
spa_load_l2cache(spa);
|
spa_load_l2cache(spa);
|
||||||
spa->spa_l2cache.sav_sync = B_TRUE;
|
spa->spa_l2cache.sav_sync = B_TRUE;
|
||||||
spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_AUX);
|
|
||||||
} else if (vd != NULL && vd->vdev_islog) {
|
} else if (vd != NULL && vd->vdev_islog) {
|
||||||
ASSERT(!locked);
|
ASSERT(!locked);
|
||||||
ASSERT(vd == vd->vdev_top);
|
ASSERT(vd == vd->vdev_top);
|
||||||
@ -5532,9 +5535,9 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
|
|||||||
/*
|
/*
|
||||||
* Clean up the vdev namespace.
|
* Clean up the vdev namespace.
|
||||||
*/
|
*/
|
||||||
|
spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
|
||||||
spa_vdev_remove_from_namespace(spa, vd);
|
spa_vdev_remove_from_namespace(spa, vd);
|
||||||
|
|
||||||
spa_event_notify(spa, vd, ESC_ZFS_VDEV_REMOVE_DEV);
|
|
||||||
} else if (vd != NULL) {
|
} else if (vd != NULL) {
|
||||||
/*
|
/*
|
||||||
* Normal vdevs cannot be removed (yet).
|
* Normal vdevs cannot be removed (yet).
|
||||||
|
Loading…
Reference in New Issue
Block a user