Skip to content

Commit

Permalink
zed: Prevent special vdev to be replaced by hot spare
Browse files Browse the repository at this point in the history
Special vdevs should not be replaced by a hot spare.
Log vdevs already support this, extending the
functionality for special vdevs.

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
  • Loading branch information
ixhamza committed Nov 3, 2022
1 parent fdc59cf commit 38a6f1c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -6819,10 +6819,12 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing,
return (spa_vdev_exit(spa, newrootvd, txg, error));

/*
* Spares can't replace logs
* log, dedup and special vdevs should not be replaced by spares.
*/
if (oldvd->vdev_top->vdev_islog && newvd->vdev_isspare)
if ((oldvd->vdev_top->vdev_alloc_bias != VDEV_BIAS_NONE ||
oldvd->vdev_top->vdev_islog) && newvd->vdev_isspare) {
return (spa_vdev_exit(spa, newrootvd, txg, ENOTSUP));
}

/*
* A dRAID spare can only replace a child of its parent dRAID vdev.
Expand Down

0 comments on commit 38a6f1c

Please sign in to comment.