Skip to content

Commit 8c225ff

Browse files
authored
Fix gang write late_arrival bug
When a write comes in via dmu_sync_late_arrival, its txg is equal to the open TXG. If that write gangs, and we have not yet activated the new gang header feature, and the gang header we pick can store a larger gang header, we will try to schedule the upgrade for the open TXG + 1. In debug mode, this causes an assertion to trip. This PR sets the TXG for activating the feature to be the larger of either the current open TXG or the syncing TXG + 1. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Paul Dagnelie <paul.dagnelie@klarasystems.com> Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Closes #17824
1 parent 7e7c360 commit 8c225ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

module/zfs/zio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3318,8 +3318,8 @@ zio_write_gang_block(zio_t *pio, metaslab_class_t *mc)
33183318
} else if (any_failed && candidate > SPA_OLD_GANGBLOCKSIZE &&
33193319
spa_feature_is_enabled(spa, SPA_FEATURE_DYNAMIC_GANG_HEADER) &&
33203320
!spa_feature_is_active(spa, SPA_FEATURE_DYNAMIC_GANG_HEADER)) {
3321-
dmu_tx_t *tx =
3322-
dmu_tx_create_assigned(spa->spa_dsl_pool, txg + 1);
3321+
dmu_tx_t *tx = dmu_tx_create_assigned(spa->spa_dsl_pool,
3322+
MAX(txg, spa_syncing_txg(spa) + 1));
33233323
dsl_sync_task_nowait(spa->spa_dsl_pool,
33243324
zio_update_feature,
33253325
(void *)SPA_FEATURE_DYNAMIC_GANG_HEADER, tx);

0 commit comments

Comments
 (0)