Skip to content

Commit

Permalink
FreeBSD: notify userspace when a vdev is removed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ryan Moeller authored Dec 2, 2020
1 parent ec50cd2 commit 0aacde2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/zed/agents/zfs_agents.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl)
* from the vdev_disk layer after a hot unplug. Fortunately we do
* get an EC_DEV_REMOVE from our disk monitor and it is a suitable
* proxy so we remap it here for the benefit of the diagnosis engine.
* Starting in OpenZFS 2.0, we do get FM_RESOURCE_REMOVED from the spa
* layer. Processing multiple FM_RESOURCE_REMOVED events is not harmful.
*/
if ((strcmp(class, EC_DEV_REMOVE) == 0) &&
(strcmp(subclass, ESC_DISK) == 0) &&
Expand Down
3 changes: 3 additions & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -7974,6 +7974,9 @@ spa_async_remove(spa_t *spa, vdev_t *vd)
vd->vdev_stat.vs_checksum_errors = 0;

vdev_state_dirty(vd->vdev_top);

/* Tell userspace that the vdev is gone. */
zfs_post_remove(spa, vd);
}

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

0 comments on commit 0aacde2

Please sign in to comment.