sys: FspFsvolReadNonCached: acquire FileNode shared

See GitHub issue #291 for discussion
This commit is contained in:
Bill Zissimopoulos 2020-07-22 15:42:06 -07:00
parent 5d0b10d0b6
commit 0296502f24
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3

View File

@ -249,9 +249,9 @@ static NTSTATUS FspFsvolReadNonCached(
if (!NT_SUCCESS(Result))
return Result;
/* acquire FileNode exclusive Full */
/* acquire FileNode shared Full */
Success = DEBUGTEST(90) &&
FspFileNodeTryAcquireExclusiveF(FileNode, FspFileNodeAcquireFull, CanWait);
FspFileNodeTryAcquireSharedF(FileNode, FspFileNodeAcquireFull, CanWait);
if (!Success)
return FspWqRepostIrpWorkItem(Irp, FspFsvolReadNonCached, 0);
@ -279,22 +279,22 @@ static NTSTATUS FspFsvolReadNonCached(
/* if this is a non-cached transfer on a cached file then flush the file */
if (!PagingIo && 0 != FileObject->SectionObjectPointer->DataSectionObject)
{
if (!CanWait)
{
FspFileNodeRelease(FileNode, Full);
if (!CanWait)
return FspWqRepostIrpWorkItem(Irp, FspFsvolReadNonCached, 0);
}
/* need to acquire exclusive for flushing */
FspFileNodeAcquireExclusive(FileNode, Full);
Result = FspFileNodeFlushAndPurgeCache(FileNode,
IrpSp->Parameters.Read.ByteOffset.QuadPart,
IrpSp->Parameters.Read.Length,
FALSE);
if (!NT_SUCCESS(Result))
{
FspFileNodeRelease(FileNode, Full);
if (!NT_SUCCESS(Result))
return Result;
}
FspFileNodeAcquireShared(FileNode, Full);
}
/* trim ReadLength during CreateProcess; resolve bugcheck for filesystem that reports incorrect size */
@ -310,9 +310,6 @@ static NTSTATUS FspFsvolReadNonCached(
ReadLength = (ULONG)(FileInfo.FileSize - ReadOffset.QuadPart);
}
/* convert FileNode to shared */
FspFileNodeConvertExclusiveToShared(FileNode, Full);
Request = FspIrpRequest(Irp);
if (0 == Request)
{