Skip evicting dbufs when walking the dbuf hash

When a dbuf is in the DB_EVICTING state it may no longer be on the
dn_dbufs list.  In which case it's unsafe to call DB_DNODE_ENTER.
Therefore, any dbuf which is found in this safe must be skipped.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2553
Closes #2495
This commit is contained in:
Brian Behlendorf 2015-02-05 17:00:05 -08:00
parent aa506dcb3d
commit e2c4acde55

View File

@ -151,9 +151,11 @@ 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)); mutex_exit(DBUF_HASH_MUTEX(h, dsh->idx));
length = __dbuf_stats_hash_table_data(buf, size, db); if (db->db_state != DB_EVICTING) {
buf += length; length = __dbuf_stats_hash_table_data(buf, size, db);
size -= length; buf += length;
size -= length;
}
mutex_exit(&db->db_mtx); mutex_exit(&db->db_mtx);
mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx)); mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx));