Skip to content

Commit 0aacde2

Browse files
author
Ryan Moeller
authored
FreeBSD: notify userspace when a vdev is removed
This is needed for zfsd to autoreplace vdevs. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #11260
1 parent ec50cd2 commit 0aacde2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cmd/zed/agents/zfs_agents.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl)
181181
* from the vdev_disk layer after a hot unplug. Fortunately we do
182182
* get an EC_DEV_REMOVE from our disk monitor and it is a suitable
183183
* proxy so we remap it here for the benefit of the diagnosis engine.
184+
* Starting in OpenZFS 2.0, we do get FM_RESOURCE_REMOVED from the spa
185+
* layer. Processing multiple FM_RESOURCE_REMOVED events is not harmful.
184186
*/
185187
if ((strcmp(class, EC_DEV_REMOVE) == 0) &&
186188
(strcmp(subclass, ESC_DISK) == 0) &&

module/zfs/spa.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7974,6 +7974,9 @@ spa_async_remove(spa_t *spa, vdev_t *vd)
79747974
vd->vdev_stat.vs_checksum_errors = 0;
79757975

79767976
vdev_state_dirty(vd->vdev_top);
7977+
7978+
/* Tell userspace that the vdev is gone. */
7979+
zfs_post_remove(spa, vd);
79777980
}
79787981

79797982
for (int c = 0; c < vd->vdev_children; c++)

0 commit comments

Comments
 (0)