From 8ef4ad71bcc819263593cdea479910cf7b33162f Mon Sep 17 00:00:00 2001 From: Jorgen Lundman Date: Thu, 28 Sep 2023 09:41:24 +0900 Subject: [PATCH] Set EndOfFile should succeed for OnDelete and !Advance The early out is for an already deleted file, not to-be-deleted. FastFat only checks for OnDeleted in the AdvanceOnly section. This allows PagingFiles to be created on ZFS. Signed-off-by: Jorgen Lundman --- module/os/windows/zfs/zfs_vnops_windows_lib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/module/os/windows/zfs/zfs_vnops_windows_lib.c b/module/os/windows/zfs/zfs_vnops_windows_lib.c index bad876c9669a..a6538da0a035 100644 --- a/module/os/windows/zfs/zfs_vnops_windows_lib.c +++ b/module/os/windows/zfs/zfs_vnops_windows_lib.c @@ -3436,21 +3436,26 @@ set_file_endoffile_information(PDEVICE_OBJECT DeviceObject, PIRP Irp, if (!zfsvfs->z_unmounted) { - // DeleteOnClose just returns OK. - if (zccb && zccb->deleteonclose) { + // Already deleted just returns OK. + if (zp->z_unlinked) { Status = STATUS_SUCCESS; goto out; } // Advance only? if (IrpSp->Parameters.SetFile.AdvanceOnly) { - if (feofi->EndOfFile.QuadPart > zp->z_size) { - Status = zfs_freesp(zp, - feofi->EndOfFile.QuadPart, - 0, 0, TRUE); - changed = 1; + // Only if not DeleteOnClose + if (!zccb || !zccb->deleteonclose) { + if (feofi->EndOfFile.QuadPart > zp->z_size) { + + Status = zfs_freesp(zp, + feofi->EndOfFile.QuadPart, + 0, 0, TRUE); + changed = 1; + } } + dprintf("%s: AdvanceOnly\n", __func__); goto out; }