From a87e1dbfce069c0d5e5804a6d35419c156b2c26a Mon Sep 17 00:00:00 2001 From: Pavel Snajdr Date: Tue, 8 Oct 2024 18:44:15 +0200 Subject: [PATCH] Avoid logging after final dirty txg is set This should avoid this VERIFY trip: VERIFY3(tx->tx_txg <= spa_final_dirty_txg(os->os_spa)) failed (63 <= 62 PANIC at dbuf.c:2324:dbuf_dirty() Showing stack for process 587858 CPU: 1 PID: 587858 Comm: txg_sync Tainted: P OE 6.10.12- Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian- Call Trace: dump_stack_lvl+0x64/0x80 spl_panic+0x100/0x120 [spl] dbuf_dirty+0xd5a/0x1300 [zfs] ? srso_alias_return_thunk+0x5/0xfbef5 ? dmu_buf_will_dirty_impl+0xdf/0x330 [zfs] spa_history_log_sync+0x11e/0x620 [zfs] ? srso_alias_return_thunk+0x5/0xfbef5 ? list_head+0x9/0x30 [zfs] ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? __cv_destroy+0x92/0x250 [spl] ? srso_alias_return_thunk+0x5/0xfbef5 ? mutex_lock+0x12/0x30 dsl_sync_task_sync+0xb9/0x120 [zfs] dsl_pool_sync+0x4c7/0x6a0 [zfs] spa_sync_iterate_to_convergence+0xd8/0x320 [zfs] spa_sync+0x308/0x8e0 [zfs] ? __wake_up+0x44/0x60 txg_sync_thread+0x272/0x3c0 [zfs] ? __pfx_txg_sync_thread+0x10/0x10 [zfs] ? __pfx_thread_generic_wrapper+0x10/0x10 [spl] thread_generic_wrapper+0x66/0x90 [spl] kthread+0xd2/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x34/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30 Signed-off-by: Pavel Snajdr --- module/zfs/spa_history.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c index de036d6c3718..9b6ee048c0e7 100644 --- a/module/zfs/spa_history.c +++ b/module/zfs/spa_history.c @@ -560,6 +560,11 @@ spa_history_log_internal(spa_t *spa, const char *operation, } } + if (htx->tx_txg > spa_final_dirty_txg(spa)) { + dmu_tx_abort(htx); + return; + } + va_start(adx, fmt); log_internal(fnvlist_alloc(), operation, spa, htx, fmt, adx); va_end(adx);