mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 08:53:01 -05:00
sys: IRP_MJ_FLUSH_BUFFERS: fix deadlock when flushing volume
This commit is contained in:
parent
83c59a6f37
commit
8ef10e5992
@ -37,6 +37,7 @@ static NTSTATUS FspFsvolFlushBuffers(
|
|||||||
FSP_FILE_DESC *FileDesc = FileObject->FsContext2;
|
FSP_FILE_DESC *FileDesc = FileObject->FsContext2;
|
||||||
FSP_FILE_NODE **FileNodes;
|
FSP_FILE_NODE **FileNodes;
|
||||||
ULONG FileNodeCount, Index;
|
ULONG FileNodeCount, Index;
|
||||||
|
PIRP TopLevelIrp;
|
||||||
IO_STATUS_BLOCK IoStatus;
|
IO_STATUS_BLOCK IoStatus;
|
||||||
FSP_FSCTL_TRANSACT_REQ *Request;
|
FSP_FSCTL_TRANSACT_REQ *Request;
|
||||||
|
|
||||||
@ -50,6 +51,10 @@ static NTSTATUS FspFsvolFlushBuffers(
|
|||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
return 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.
|
* 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
|
* This would be useful if we ever started flushing directories, but since we do not
|
||||||
@ -65,6 +70,8 @@ static NTSTATUS FspFsvolFlushBuffers(
|
|||||||
FlushResult = Result;
|
FlushResult = Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IoSetTopLevelIrp(TopLevelIrp);
|
||||||
|
|
||||||
FspFileNodeDeleteList(FileNodes, FileNodeCount);
|
FspFileNodeDeleteList(FileNodes, FileNodeCount);
|
||||||
|
|
||||||
Result = FspIopCreateRequest(Irp, 0, 0, &Request);
|
Result = FspIopCreateRequest(Irp, 0, 0, &Request);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user