summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2016-07-12 12:23:43 -0700
committerNed Bass <[email protected]>2016-09-09 13:21:09 -0700
commit58000c3ec73d55c2065a3a504722b98360612a54 (patch)
tree50874e556b14dc0d5c8937e98757387a8ebccea9
parente871059bc4087e69dbda7f78fe1d151014109673 (diff)
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4846
-rw-r--r--module/zfs/dbuf_stats.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/module/zfs/dbuf_stats.c b/module/zfs/dbuf_stats.c
index afdf828ed..6f39f80e5 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));