From 02de3e3c5d54bd545b34cccfd35ace80edd1f864 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Tue, 12 Jul 2016 12:23:43 -0700 Subject: [PATCH] Fix dbuf_stats_hash_table_data race Dropping DBUF_HASH_MUTEX when walking the hash list is unsafe. The dbuf can be freed at any time. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #4846 --- module/zfs/dbuf_stats.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/zfs/dbuf_stats.c b/module/zfs/dbuf_stats.c index afdf828ed542..6f39f80e563a 100644 --- a/module/zfs/dbuf_stats.c +++ b/module/zfs/dbuf_stats.c @@ -148,7 +148,6 @@ dbuf_stats_hash_table_data(char *buf, size_t size, void *data) } mutex_enter(&db->db_mtx); - mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx)); if (db->db_state != DB_EVICTING) { length = __dbuf_stats_hash_table_data(buf, size, db); @@ -157,7 +156,6 @@ dbuf_stats_hash_table_data(char *buf, size_t size, void *data) } mutex_exit(&db->db_mtx); - mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx)); } mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx));