Skip to content

Commit

Permalink
zed: prevent automatic replacement of offline vdevs
Browse files Browse the repository at this point in the history
When a device is in a REMOVED state, a spare kicks in automatically.
However, this behavior differs in FreeBSD, where we do not transition
from OFFLINE to REMOVED.
Our support team has encountered cases where customers who replaced
their own drives experienced unexpected behavior, 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 and
does not transition to REMOVED, preventing it from being replaced by a
spare.

Signed-off-by: Ameer Hamza <[email protected]>
  • Loading branch information
ixhamza committed Nov 13, 2024
1 parent 1c9a4c8 commit 3509128
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/zed/agents/zfs_retire.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3509128

Please sign in to comment.