From d4f3cfd4050474ce53210819606d5d33d692a5df Mon Sep 17 00:00:00 2001 From: Ameer Hamza Date: Wed, 13 Nov 2024 18:14:25 +0500 Subject: [PATCH] zed: prevent automatic replacement of offline vdevs When an OFFLINE device is hot-plugged, a spare is automatically activated. However, this behavior differs in FreeBSD, where we do not transition from OFFLINE state to REMOVED. Our support team has encountered cases where customers experienced unexpected behavior during drive replacements, with multiple spares activating for the same VDEV due to a single disk replacement. This patch ensures that a drive in an OFFLINE state remains in that state, preventing it from transitioning to REMOVED and being automatically replaced by a spare. Signed-off-by: Ameer Hamza --- cmd/zed/agents/zfs_retire.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/zed/agents/zfs_retire.c b/cmd/zed/agents/zfs_retire.c index 1ef5c631a438..bf8e322cdf33 100644 --- a/cmd/zed/agents/zfs_retire.c +++ b/cmd/zed/agents/zfs_retire.c @@ -445,9 +445,10 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, * its a loopback event from spa_async_remove(). Just * ignore it. */ - if (vs->vs_state == VDEV_STATE_REMOVED && - state == VDEV_STATE_REMOVED) + if ((vs->vs_state == VDEV_STATE_REMOVED && state == + VDEV_STATE_REMOVED) || vs->vs_state == VDEV_STATE_OFFLINE) { return; + } /* Remove the vdev since device is unplugged */ int remove_status = 0;