From aa964ce61b14a697939a3ec46b7d87115f321634 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Tue, 10 Jun 2025 13:41:27 +1000 Subject: [PATCH] zfs_log_write: only put the callback on the last itx If a write is split across mutliple itxs, we only want the callback on the last one, otherwise it will be called for every itx associated with this single write, which makes it very hard to know what to clean up. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Mark Johnston Reviewed-by: Alexander Motin Signed-off-by: Rob Norris Closes #17445 --- module/zfs/zfs_log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/zfs/zfs_log.c b/module/zfs/zfs_log.c index ddc3e0fc0..2ce25b72b 100644 --- a/module/zfs/zfs_log.c +++ b/module/zfs/zfs_log.c @@ -694,8 +694,11 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, itx->itx_sync = (zp->z_sync_cnt != 0); itx->itx_gen = gen; - itx->itx_callback = callback; - itx->itx_callback_data = callback_data; + if (resid == len) { + itx->itx_callback = callback; + itx->itx_callback_data = callback_data; + } + zil_itx_assign(zilog, itx, tx); off += len;