X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fztest%2Fztest.c;h=07b81cc27ee298b700874fd4fc2bf6894acbe8e3;hb=a1e147eef8f61f3fcac742952d56b1f9d6c2703b;hp=c9fdf466f5488804fc50722737d946d90affe74f;hpb=ea0b2538cd5967fcdf26b7b7c01859a060fef3e3;p=zfs.git diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index c9fdf46..07b81cc 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -4965,7 +4965,18 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id) if (islog) (void) rw_exit(&ztest_name_lock); } else { + /* + * Ideally we would like to be able to randomly + * call vdev_[on|off]line without holding locks + * to force unpredictable failures but the side + * effects of vdev_[on|off]line prevent us from + * doing so. We grab the ztest_vdev_lock here to + * prevent a race between injection testing and + * aux_vdev removal. + */ + mutex_enter(&ztest_vdev_lock); (void) vdev_online(spa, guid0, 0, NULL); + mutex_exit(&ztest_vdev_lock); } }