From 2518f4b1249bc8a5ae50b338898012e64a231153 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 9 Jul 2025 14:34:02 -0700 Subject: [PATCH] Revert "Fix incorrect expected error in ztest" This reverts commit 2076011e0c4c2d8ad6a59534a4784a6aa5f4f3df. The comment which explains EINVAL should be expected for this case was wrong, not the code. The kernel will return ENOTSUP when attaching a distributed spare to the wrong top-level dRAID vdev. See the check for this in spa_vdev_attach(). Reviewed-by: Paul Dagnelie Signed-off-by: Brian Behlendorf Closes #17503 --- cmd/ztest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ztest.c b/cmd/ztest.c index 8c0fc4513..2c8250405 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -3881,7 +3881,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) * If newvd is too small, it should fail with EOVERFLOW. * * If newvd is a distributed spare and it's being attached to a - * dRAID which is not its parent it should fail with EINVAL. + * dRAID which is not its parent it should fail with ENOTSUP. */ if (pvd->vdev_ops != &vdev_mirror_ops && pvd->vdev_ops != &vdev_root_ops && (!replacing || @@ -3900,7 +3900,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) else if (ashift > oldvd->vdev_top->vdev_ashift) expected_error = EDOM; else if (newvd_is_dspare && pvd != vdev_draid_spare_get_parent(newvd)) - expected_error = EINVAL; + expected_error = ENOTSUP; else expected_error = 0;