Skip to content

Commit

Permalink
dbuf_is_metadata: ensure that it returns B_TRUE or B_FALSE
Browse files Browse the repository at this point in the history
Without this patch, the

    ASSERT3U(dbuf_is_metadata(db), ==, arc_is_metadata(buf));

at the beginning of dbuf_assign_arcbuf can panic
if the object type is a DMU_OT_NEWTYPE that has
DMU_OT_METADATA set.

Signed-off-by: Christian Schwarz <christian.schwarz@nutanix.com>
  • Loading branch information
cschwarz-nutanix committed Sep 5, 2022
1 parent 2d5622f commit 56f21b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ dbuf_is_metadata(dmu_buf_impl_t *db)
boolean_t is_metadata;

DB_DNODE_ENTER(db);
is_metadata = DMU_OT_IS_METADATA(DB_DNODE(db)->dn_type);
is_metadata = !!DMU_OT_IS_METADATA(DB_DNODE(db)->dn_type);
DB_DNODE_EXIT(db);

return (is_metadata);
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/dbuf_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, dmu_buf_impl_t *db)
(longlong_t)db->db_blkid,
(u_longlong_t)db->db.db_offset,
(u_longlong_t)db->db.db_size,
!!dbuf_is_metadata(db),
dbuf_is_metadata(db),
db->db_state,
(ulong_t)zfs_refcount_count(&db->db_holds),
multilist_link_active(&db->db_cache_link),
Expand Down

0 comments on commit 56f21b6

Please sign in to comment.