diff --git a/src/sys/flush.c b/src/sys/flush.c index 407110c4..90255991 100644 --- a/src/sys/flush.c +++ b/src/sys/flush.c @@ -37,6 +37,7 @@ static NTSTATUS FspFsvolFlushBuffers( FSP_FILE_DESC *FileDesc = FileObject->FsContext2; FSP_FILE_NODE **FileNodes; ULONG FileNodeCount, Index; + PIRP TopLevelIrp; IO_STATUS_BLOCK IoStatus; FSP_FSCTL_TRANSACT_REQ *Request; @@ -50,6 +51,10 @@ static NTSTATUS FspFsvolFlushBuffers( if (!NT_SUCCESS(Result)) return Result; + /* reset the top-level IRP to avoid deadlock on the FileNodes' resources */ + TopLevelIrp = IoGetTopLevelIrp(); + IoSetTopLevelIrp(0); + /* * Enumerate in reverse order so that files are flushed before containing directories. * This would be useful if we ever started flushing directories, but since we do not @@ -65,6 +70,8 @@ static NTSTATUS FspFsvolFlushBuffers( FlushResult = Result; } + IoSetTopLevelIrp(TopLevelIrp); + FspFileNodeDeleteList(FileNodes, FileNodeCount); Result = FspIopCreateRequest(Irp, 0, 0, &Request);