mirror of
https://github.com/winfsp/winfsp.git
synced 2026-07-29 07:49:24 -05:00
sys: FspFsvolWriteCached: move CcCanIWrite outside the locks
This eliminates the deadlock described in PR #677 while at the same time ensuring that CcDeferWrite is called after the file's cache map has been initialized.
This commit is contained in:
+6
-2
@@ -247,8 +247,13 @@ static NTSTATUS FspFsvolWriteCached(
|
||||
FILE_END_OF_FILE_INFORMATION EndOfFileInformation;
|
||||
UINT64 WriteEndOffset;
|
||||
BOOLEAN ExtendingFile;
|
||||
BOOLEAN DeferWrite;
|
||||
BOOLEAN Success;
|
||||
|
||||
/* should we defer the write? */
|
||||
Success = DEBUGTEST(90) && CcCanIWrite(FileObject, WriteLength, CanWait, Retrying);
|
||||
DeferWrite = !Success;
|
||||
|
||||
/* try to acquire the FileNode Main exclusive */
|
||||
Success = DEBUGTEST(90) &&
|
||||
FspFileNodeTryAcquireExclusiveF(FileNode, FspFileNodeAcquireMain, CanWait);
|
||||
@@ -306,8 +311,7 @@ static NTSTATUS FspFsvolWriteCached(
|
||||
}
|
||||
|
||||
/* should we defer the write? */
|
||||
Success = DEBUGTEST(90) && CcCanIWrite(FileObject, WriteLength, CanWait, Retrying);
|
||||
if (!Success)
|
||||
if (DeferWrite)
|
||||
{
|
||||
Result = FspWqCreateIrpWorkItem(Irp, FspFsvolWriteCached, 0);
|
||||
if (NT_SUCCESS(Result))
|
||||
|
||||
Reference in New Issue
Block a user