From fc741beb08dfbdf177eacf09e88c4d75dddda66b Mon Sep 17 00:00:00 2001 From: Jorgen Lundman Date: Sat, 4 Nov 2023 16:19:34 +0900 Subject: [PATCH] Attempt work around for zfs log write issue while(resid) { gets stuck as it picks len==0 due to blocksize==0 due to zblksz==0. Signed-off-by: Jorgen Lundman --- module/os/windows/zfs/zfs_vnops_windows.c | 2 +- module/os/windows/zfs/zfs_znode.c | 3 +++ module/zfs/zfs_log.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/module/os/windows/zfs/zfs_vnops_windows.c b/module/os/windows/zfs/zfs_vnops_windows.c index 2394031d9eb2..24f435940a50 100644 --- a/module/os/windows/zfs/zfs_vnops_windows.c +++ b/module/os/windows/zfs/zfs_vnops_windows.c @@ -5026,7 +5026,7 @@ zfs_write_wrap(PDEVICE_OBJECT DeviceObject, PIRP Irp, (uint64_t)vp->FileHeader.AllocationSize.QuadPart) { Status = zfs_freesp(zp, - newlength, 0, FWRITE, B_TRUE); + newlength, 0, FWRITE, B_FALSE); if (!NT_SUCCESS(Status)) { dprintf("extend_file returned %08lx\n", Status); diff --git a/module/os/windows/zfs/zfs_znode.c b/module/os/windows/zfs/zfs_znode.c index eff94188fffb..bfa2e41b3bc3 100644 --- a/module/os/windows/zfs/zfs_znode.c +++ b/module/os/windows/zfs/zfs_znode.c @@ -550,6 +550,9 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, ASSERT(zp->z_dirlocks == NULL); ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs)); + if (blksz == 0) + blksz = 0x200; + /* * Defer setting z_zfsvfs until the znode is ready to be a candidate for * the zfs_znode_move() callback. diff --git a/module/zfs/zfs_log.c b/module/zfs/zfs_log.c index ee973d40f701..613fcdb2327a 100644 --- a/module/zfs/zfs_log.c +++ b/module/zfs/zfs_log.c @@ -676,6 +676,8 @@ zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype, else if (wr_state == WR_INDIRECT) len = MIN(blocksize - P2PHASE(off, blocksize), resid); + ASSERT3U(len, >, 0); + itx = zil_itx_create(txtype, sizeof (*lr) + (wr_state == WR_COPIED ? len : 0)); lr = (lr_write_t *)&itx->itx_lr;