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
parent 90d2c4407a
commit 2518f4b124

View File

@ -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 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 ||
@ -3900,7 +3900,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;