From e2c4acde55931ae58d5bf5fd394567a96e942a5c Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 5 Feb 2015 17:00:05 -0800 Subject: [PATCH] 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 Closes #2553 Closes #2495 --- module/zfs/dbuf_stats.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/zfs/dbuf_stats.c b/module/zfs/dbuf_stats.c index 3b9c63d31e..5e7eaf1acf 100644 --- a/module/zfs/dbuf_stats.c +++ b/module/zfs/dbuf_stats.c @@ -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));