aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2023-01-04 15:59:50 -0800
committerBrian Behlendorf <[email protected]>2023-01-10 13:26:44 -0800
commit4208a052c2c9d43f6e3f6794e60419f9f636716b (patch)
treed566dfacb13ae183a15531a6d05553956bf4b420 /cmd
parent40d7e971ffc16b2ef993a6e9da40a8b3ca91ad01 (diff)
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #14351
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ztest.c7
1 files changed, 6 insertions, 1 deletions
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;