From 4208a052c2c9d43f6e3f6794e60419f9f636716b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 4 Jan 2023 15:59:50 -0800 Subject: ztest: update expectation for sparing a special device Commit c23738c70eb86a7f04f93292caef2ed977047608 modified the expected behavior of attach to prevent hot spares from being used as special vdev replacements. We update ztest's expectations accordingly to prevent it from failing when testing the updated behavior. Reviewed-by: Richard Yao Signed-off-by: Brian Behlendorf Closes #14351 --- cmd/ztest.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/ztest.c b/cmd/ztest.c index 4a031dac2..721abe981 100644 --- a/cmd/ztest.c +++ b/cmd/ztest.c @@ -3597,6 +3597,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) int newvd_is_spare = B_FALSE; int newvd_is_dspare = B_FALSE; int oldvd_is_log; + int oldvd_is_special; int error, expected_error; if (ztest_opts.zo_mmp_test) @@ -3671,6 +3672,9 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) oldguid = oldvd->vdev_guid; oldsize = vdev_get_min_asize(oldvd); oldvd_is_log = oldvd->vdev_top->vdev_islog; + oldvd_is_special = + oldvd->vdev_top->vdev_alloc_bias == VDEV_BIAS_SPECIAL || + oldvd->vdev_top->vdev_alloc_bias == VDEV_BIAS_DEDUP; (void) strlcpy(oldpath, oldvd->vdev_path, MAXPATHLEN); pvd = oldvd->vdev_parent; pguid = pvd->vdev_guid; @@ -3749,7 +3753,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) pvd->vdev_ops == &vdev_replacing_ops || pvd->vdev_ops == &vdev_spare_ops)) expected_error = ENOTSUP; - else if (newvd_is_spare && (!replacing || oldvd_is_log)) + else if (newvd_is_spare && + (!replacing || oldvd_is_log || oldvd_is_special)) expected_error = ENOTSUP; else if (newvd == oldvd) expected_error = replacing ? 0 : EBUSY; -- cgit v1.2.3