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 <david.chen@osnexus.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4846
This commit is contained in:
parent
e871059bc4
commit
58000c3ec7
|
@ -148,7 +148,6 @@ dbuf_stats_hash_table_data(char *buf, size_t size, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_enter(&db->db_mtx);
|
mutex_enter(&db->db_mtx);
|
||||||
mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx));
|
|
||||||
|
|
||||||
if (db->db_state != DB_EVICTING) {
|
if (db->db_state != DB_EVICTING) {
|
||||||
length = __dbuf_stats_hash_table_data(buf, size, db);
|
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_exit(&db->db_mtx);
|
||||||
mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx));
|
|
||||||
}
|
}
|
||||||
mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx));
|
mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue