summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ztest
diff options
context:
space:
mode:
authorGeorge Wilson <george.wilson@delphix.com>2012-09-27 21:55:09 -0700
committerGeorge Wilson <george.wilson@delphix.com>2012-09-27 21:55:09 -0700
commit9253d63df408bb48584e0b1abfcc24ef2472382e (patch)
tree88c4e2e3193ee83fded3114bb8a328fc4b612aaf /usr/src/cmd/ztest
parentc13be35a2c14be5433f5d23a6c4f84e66439b7b6 (diff)
downloadillumos-joyent-9253d63df408bb48584e0b1abfcc24ef2472382e.tar.gz
3145 single-copy arc
3212 ztest: race condition between vdev_online() and spa_vdev_remove() Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com> Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Justin T. Gibbs <gibbs@scsiguy.com> Approved by: Eric Schrock <eric.schrock@delphix.com>
Diffstat (limited to 'usr/src/cmd/ztest')
-rw-r--r--usr/src/cmd/ztest/ztest.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c
index 95b8e2ed79..0f9e57ef45 100644
--- a/usr/src/cmd/ztest/ztest.c
+++ b/usr/src/cmd/ztest/ztest.c
@@ -4695,7 +4695,18 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
if (islog)
(void) rw_unlock(&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.
+ */
+ VERIFY(mutex_lock(&ztest_vdev_lock) == 0);
(void) vdev_online(spa, guid0, 0, NULL);
+ VERIFY(mutex_unlock(&ztest_vdev_lock) == 0);
}
}