From cde04badd1d76e3af050fb0232d06af8550e8b8b Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Thu, 8 Sep 2022 02:04:15 +0200 Subject: [PATCH] make DMU_OT_IS_METADATA and DMU_OT_IS_ENCRYPTED return B_TRUE or B_FALSE 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. While we're at it, fix DMU_OT_IS_ENCRYPTED as well. Reviewed-by: Richard Yao Reviewed-by: Alexander Motin Signed-off-by: Christian Schwarz Closes #13842 --- include/sys/dmu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sys/dmu.h b/include/sys/dmu.h index 0cf4dbc9f9..070d27fde3 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -136,7 +136,7 @@ typedef enum dmu_object_byteswap { #endif #define DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \ - ((ot) & DMU_OT_METADATA) : \ + (((ot) & DMU_OT_METADATA) != 0) : \ DMU_OT_IS_METADATA_IMPL(ot)) #define DMU_OT_IS_DDT(ot) \ @@ -147,7 +147,7 @@ typedef enum dmu_object_byteswap { ((ot) == DMU_OT_PLAIN_FILE_CONTENTS || (ot) == DMU_OT_UINT64_OTHER) #define DMU_OT_IS_ENCRYPTED(ot) (((ot) & DMU_OT_NEWTYPE) ? \ - ((ot) & DMU_OT_ENCRYPTED) : \ + (((ot) & DMU_OT_ENCRYPTED) != 0) : \ DMU_OT_IS_ENCRYPTED_IMPL(ot)) /*