Skip to content

Commit

Permalink
Assert if we're logging after final txg was set
Browse files Browse the repository at this point in the history
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
  • Loading branch information
snajpa authored Nov 25, 2024
1 parent d0a91b9 commit d2b0ca9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions module/zfs/spa_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ spa_history_log_nvl(spa_t *spa, nvlist_t *nvl)
return (err);
}

ASSERT3UF(tx->tx_txg, <=, spa_final_dirty_txg(spa),
"Logged %s after final txg was set!", "nvlist");

VERIFY0(nvlist_dup(nvl, &nvarg, KM_SLEEP));
if (spa_history_zone() != NULL) {
fnvlist_add_string(nvarg, ZPOOL_HIST_ZONE,
Expand Down Expand Up @@ -527,6 +530,9 @@ log_internal(nvlist_t *nvl, const char *operation, spa_t *spa,
return;
}

ASSERT3UF(tx->tx_txg, <=, spa_final_dirty_txg(spa),
"Logged after final txg was set: %s %s", operation, fmt);

msg = kmem_vasprintf(fmt, adx);
fnvlist_add_string(nvl, ZPOOL_HIST_INT_STR, msg);
kmem_strfree(msg);
Expand Down

0 comments on commit d2b0ca9

Please sign in to comment.