From 06401e42221d2f5130065caf70f8276ba4d19acd Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 6 Dec 2017 18:30:15 -0500 Subject: [PATCH] Fix ztest_verify_dnode_bt() test case In ztest_verify_dnode_bt the ztest_object_lock must be held in order to safely verify the unused bonus space. Reviewed-by: DHE Signed-off-by: Brian Behlendorf Closes #6941 --- cmd/ztest/ztest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 46dd903f84..89ef1c4150 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -5172,8 +5172,11 @@ ztest_verify_dnode_bt(ztest_ds_t *zd, uint64_t id) dmu_object_info_t doi; dmu_buf_t *db; - if (dmu_bonus_hold(os, obj, FTAG, &db) != 0) + ztest_object_lock(zd, obj, RL_READER); + if (dmu_bonus_hold(os, obj, FTAG, &db) != 0) { + ztest_object_unlock(zd, obj); continue; + } dmu_object_info_from_db(db, &doi); if (doi.doi_bonus_size >= sizeof (*bt)) @@ -5187,6 +5190,7 @@ ztest_verify_dnode_bt(ztest_ds_t *zd, uint64_t id) } dmu_buf_rele(db, FTAG); + ztest_object_unlock(zd, obj); } }