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 change was developed under this PR:

openzfs#16795

Signed-off-by: Pavel Snajdr <[email protected]>
  • Loading branch information
amotin authored and snajpa committed Nov 21, 2024
1 parent ff3df12 commit 84cfff6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/zfs/spa_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,15 @@ spa_history_log_nvl(spa_t *spa, nvlist_t *nvl)

tx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir);
err = dmu_tx_assign(tx, TXG_WAIT);

if (err) {
dmu_tx_abort(tx);
return (err);
}

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

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 +531,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 84cfff6

Please sign in to comment.