Skip to content

Commit

Permalink
Skip evicting dbufs when walking the dbuf hash
Browse files Browse the repository at this point in the history
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
  • Loading branch information
behlendorf committed Feb 6, 2015
1 parent aa506dc commit e2c4acd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions module/zfs/dbuf_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ 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));

length = __dbuf_stats_hash_table_data(buf, size, db);
buf += length;
size -= length;
if (db->db_state != DB_EVICTING) {
length = __dbuf_stats_hash_table_data(buf, size, db);
buf += length;
size -= length;
}

mutex_exit(&db->db_mtx);
mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx));
Expand Down

0 comments on commit e2c4acd

Please sign in to comment.