]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix ztest_verify_dnode_bt() test case
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 6 Dec 2017 23:30:15 +0000 (18:30 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 9 Jan 2018 20:27:12 +0000 (12:27 -0800)
In ztest_verify_dnode_bt the ztest_object_lock must be held in
order to safely verify the unused bonus space.

Reviewed-by: DHE <git@dehacked.net>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #6941

cmd/ztest/ztest.c

index 46dd903f84498e2a8374e88070260f03923a17c6..89ef1c4150fddba429bdf1cef6702f8d6fae18c3 100644 (file)
@@ -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);
        }
 }