Revert "Fix incorrect expected error in ztest"

This reverts commit 2076011e0c.  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 <paul.dagnelie@klarasystems.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #17503
This commit is contained in:
Brian Behlendorf 2025-07-09 14:34:02 -07:00 committed by GitHub
parent a981cb69e4
commit ea38787f2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3882,7 +3882,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 too small, it should fail with EOVERFLOW.
* *
* If newvd is a distributed spare and it's being attached to a * 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 && if (pvd->vdev_ops != &vdev_mirror_ops &&
pvd->vdev_ops != &vdev_root_ops && (!replacing || pvd->vdev_ops != &vdev_root_ops && (!replacing ||
@ -3901,7 +3901,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
else if (ashift > oldvd->vdev_top->vdev_ashift) else if (ashift > oldvd->vdev_top->vdev_ashift)
expected_error = EDOM; expected_error = EDOM;
else if (newvd_is_dspare && pvd != vdev_draid_spare_get_parent(newvd)) else if (newvd_is_dspare && pvd != vdev_draid_spare_get_parent(newvd))
expected_error = EINVAL; expected_error = ENOTSUP;
else else
expected_error = 0; expected_error = 0;