From 077269bfeddf2d35eb20f98289ac9d017b4a32ff Mon Sep 17 00:00:00 2001 From: Jitendra Patidar Date: Wed, 13 Aug 2025 02:49:05 +0530 Subject: [PATCH] Fix Assert in dbuf_undirty, which triggers during usage zap shrink Usage zap's (DMU_*USED_OBJECT) are updated in syncing context via do_userquota_cacheflush(). zap shrink triggers, ASSERT(db->db_objset == dmu_objset_pool(db->db_objset)->dp_meta_objset || txg != spa_syncing_txg(dmu_objset_spa(db->db_objset))); DMU_*USED_OBJECT are special object (DMU_OBJECT_IS_SPECIAL), gets updated in syncing context only. So, relax assert for it. Reviewed-by: Brian Behlendorf Signed-off-by: Jitendra Patidar Closes #17602 --- module/zfs/dbuf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 3d0f88b36..7403f10d9 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -2557,12 +2557,13 @@ dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx) /* * Due to our use of dn_nlevels below, this can only be called - * in open context, unless we are operating on the MOS. - * From syncing context, dn_nlevels may be different from the - * dn_nlevels used when dbuf was dirtied. + * in open context, unless we are operating on the MOS or it's + * a special object. From syncing context, dn_nlevels may be + * different from the dn_nlevels used when dbuf was dirtied. */ ASSERT(db->db_objset == dmu_objset_pool(db->db_objset)->dp_meta_objset || + DMU_OBJECT_IS_SPECIAL(db->db.db_object) || txg != spa_syncing_txg(dmu_objset_spa(db->db_objset))); ASSERT(db->db_blkid != DMU_BONUS_BLKID); ASSERT0(db->db_level);