Windows driver: queue volume flushes as ordered barriers

Route IRP_MJ_FLUSH_BUFFERS through EncryptedIoQueue for mounted writable non-system volumes. Flushes are represented as zero-length queue items handled by the I/O thread, so ZwFlushBuffersFile runs after earlier encrypted write fragments before completing to the caller.

Also perform a best-effort ZwFlushBuffersFile before closing writable mounted-volume host handles, after the encrypted I/O queue has drained, so clean dismount/shutdown paths push the host file or raw device before close.

This keeps the change focused on ordinary mounted-volume flush ordering and avoids system-encryption, boot-drive, and header-update paths.
This commit is contained in:
Mounir IDRASSI
2026-05-21 09:57:35 +09:00
parent 79bee911be
commit d1f73ce429
4 changed files with 83 additions and 3 deletions

View File

@@ -155,6 +155,7 @@ typedef struct
EncryptedIoQueue *Queue;
PIRP OriginalIrp;
BOOL Write;
BOOL Flush;
ULONG OriginalLength;
LARGE_INTEGER OriginalOffset;
NTSTATUS Status;