From 7bbd42ef49540e92a0dcd4abf9c6b24f98fbb7f4 Mon Sep 17 00:00:00 2001 From: Don Brady Date: Mon, 27 Nov 2023 10:46:38 -0700 Subject: [PATCH] Don't allow attach to a raidz child vdev Reviewed-by: Richard Yao Reviewed-by: Brian Behlendorf Signed-off-by: Don Brady Closes #15536 Closes #15564 --- module/zfs/spa.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 20225640f8..5161326c03 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -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;