From d5616ad34a2f3242adefce11542a965e0628e545 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 16 May 2025 13:23:32 -0400 Subject: [PATCH] Increase meta-dnode redundancy in "some" mode Loss of one indirect block of the meta dnode likely means loss of the whole dataset. It is worse than one file that the man page promises, and in my opinion is not much better than "none" mode. This change restores redundancy of the meta-dnode indirect blocks, while same time still corrects expectations in the man page. Reviewed-by: Akash B Reviewed-by: Brian Behlendorf Reviewed-by: Rob Norris Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. Closes #17339 --- include/sys/dmu.h | 4 ++-- man/man7/zfsprops.7 | 3 ++- module/zfs/dmu.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/sys/dmu.h b/include/sys/dmu.h index 7871eacc2..7eed5f48b 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -144,9 +144,9 @@ typedef enum dmu_object_byteswap { #define DMU_OT_IS_DDT(ot) \ ((ot) == DMU_OT_DDT_ZAP) -#define DMU_OT_IS_CRITICAL(ot) \ +#define DMU_OT_IS_CRITICAL(ot, level) \ (DMU_OT_IS_METADATA(ot) && \ - (ot) != DMU_OT_DNODE && \ + ((ot) != DMU_OT_DNODE || (level) > 0) && \ (ot) != DMU_OT_DIRECTORY_CONTENTS && \ (ot) != DMU_OT_SA) diff --git a/man/man7/zfsprops.7 b/man/man7/zfsprops.7 index 42ce1fea6..b7b1047a8 100644 --- a/man/man7/zfsprops.7 +++ b/man/man7/zfsprops.7 @@ -1632,7 +1632,8 @@ When set to ZFS stores an extra copy of only critical metadata. This can improve file create performance since less metadata needs to be written. -If a single on-disk block is corrupt, at worst a single user file can be lost. +If a single on-disk block is corrupt, multiple user files or directories +can be lost. .Pp When set to .Sy none , diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index b3cea3fbf..131b1d65d 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -2358,7 +2358,7 @@ dmu_write_policy(objset_t *os, dnode_t *dn, int level, int wp, zio_prop_t *zp) gang_copies++; break; case ZFS_REDUNDANT_METADATA_SOME: - if (DMU_OT_IS_CRITICAL(type)) { + if (DMU_OT_IS_CRITICAL(type, level)) { copies++; gang_copies++; } else if (DMU_OT_IS_METADATA(type)) {