Skip to content

Commit

Permalink
zil: Relax assertion in zil_parse
Browse files Browse the repository at this point in the history
Rather than panic debug builds when we fail to parse a whole ZIL, let's
instead improve the logging of errors and continue like in a release
build.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #14116
  • Loading branch information
Ryan Moeller authored and behlendorf committed Nov 1, 2022
1 parent 186e39f commit b27c7a1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions module/zfs/zil.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,18 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,

error = zil_read_log_block(zilog, decrypt, &blk, &next_blk,
lrbuf, &end);
if (error != 0)
if (error != 0) {
if (claimed) {
char name[ZFS_MAX_DATASET_NAME_LEN];

dmu_objset_name(zilog->zl_os, name);

cmn_err(CE_WARN, "ZFS read log block error %d, "
"dataset %s, seq 0x%llx\n", error, name,
(u_longlong_t)blk_seq);
}
break;
}

for (lrp = lrbuf; lrp < end; lrp += reclen) {
lr_t *lr = (lr_t *)lrp;
Expand All @@ -422,10 +432,6 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
zilog->zl_parse_blk_count = blk_count;
zilog->zl_parse_lr_count = lr_count;

ASSERT(!claimed || !(zh->zh_flags & ZIL_CLAIM_LR_SEQ_VALID) ||
(max_blk_seq == claim_blk_seq && max_lr_seq == claim_lr_seq) ||
(decrypt && error == EIO));

zil_bp_tree_fini(zilog);
zio_buf_free(lrbuf, SPA_OLD_MAXBLOCKSIZE);

Expand Down

0 comments on commit b27c7a1

Please sign in to comment.