Skip to content

Commit

Permalink
Don't allow attach to a raidz child vdev
Browse files Browse the repository at this point in the history
Reviewed-by: Richard Yao <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes #15536
Closes #15564
  • Loading branch information
Don Brady authored Nov 27, 2023
1 parent a94860a commit 7bbd42e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -7063,12 +7063,13 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing,

if (!replacing) {
/*
* For attach, the only allowable parent is a mirror or the root
* vdev.
* For attach, the only allowable parent is a mirror or
* the root vdev. A raidz vdev can be attached to, but
* you cannot attach to a raidz child.
*/
if (pvd->vdev_ops != &vdev_mirror_ops &&
pvd->vdev_ops != &vdev_raidz_ops &&
pvd->vdev_ops != &vdev_root_ops)
pvd->vdev_ops != &vdev_root_ops &&
!raidz)
return (spa_vdev_exit(spa, newrootvd, txg, ENOTSUP));

pvops = &vdev_mirror_ops;
Expand Down

0 comments on commit 7bbd42e

Please sign in to comment.