Skip to content

Commit

Permalink
Set EndOfFile should succeed for OnDelete and !Advance
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lundman committed Sep 28, 2023
1 parent 467d279 commit 8ef4ad7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions module/os/windows/zfs/zfs_vnops_windows_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8ef4ad7

Please sign in to comment.