Skip to content

Commit d2b0ca9

Browse files
snajpaamotin
andauthored
Assert if we're logging after final txg was set
This allowed to debug #16714, fixed in #16782. Without assertions added here it is difficult to figure out what logs cause the problem, since the assertion happens in sync thread context. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Pavel Snajdr <[email protected]> Co-authored-by: Alexander Motin <[email protected]> Closes #16795
1 parent d0a91b9 commit d2b0ca9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

module/zfs/spa_history.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ spa_history_log_nvl(spa_t *spa, nvlist_t *nvl)
390390
return (err);
391391
}
392392

393+
ASSERT3UF(tx->tx_txg, <=, spa_final_dirty_txg(spa),
394+
"Logged %s after final txg was set!", "nvlist");
395+
393396
VERIFY0(nvlist_dup(nvl, &nvarg, KM_SLEEP));
394397
if (spa_history_zone() != NULL) {
395398
fnvlist_add_string(nvarg, ZPOOL_HIST_ZONE,
@@ -527,6 +530,9 @@ log_internal(nvlist_t *nvl, const char *operation, spa_t *spa,
527530
return;
528531
}
529532

533+
ASSERT3UF(tx->tx_txg, <=, spa_final_dirty_txg(spa),
534+
"Logged after final txg was set: %s %s", operation, fmt);
535+
530536
msg = kmem_vasprintf(fmt, adx);
531537
fnvlist_add_string(nvl, ZPOOL_HIST_INT_STR, msg);
532538
kmem_strfree(msg);

0 commit comments

Comments
 (0)