mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
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
8887c7d778
commit
02de3e3c5d
@ -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
Block a user