Don't allow attach to a raidz child vdev

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Don Brady <don.brady@klarasystems.com>
Closes #15536
Closes #15564
This commit is contained in:
Don Brady 2023-11-27 10:46:38 -07:00 committed by GitHub
parent a94860a6de
commit 7bbd42ef49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -7063,12 +7063,13 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing,
if (!replacing) { if (!replacing) {
/* /*
* For attach, the only allowable parent is a mirror or the root * For attach, the only allowable parent is a mirror or
* vdev. * 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 && 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)); return (spa_vdev_exit(spa, newrootvd, txg, ENOTSUP));
pvops = &vdev_mirror_ops; pvops = &vdev_mirror_ops;