mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[NPFS]
- Reset read and write events directly before waiting. Fixes an issue where a read could return 0 bytes if the previous read had read all available data without waiting (thus leaving the event set). svn path=/trunk/; revision=57424
This commit is contained in:
parent
327b7435b7
commit
8790296cbe
1 changed files with 3 additions and 5 deletions
|
@ -393,6 +393,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
/* this is a new request */
|
||||
Irp->IoStatus.Information = 0;
|
||||
KeResetEvent(&Ccb->ReadEvent);
|
||||
Context->WaitEvent = &Ccb->ReadEvent;
|
||||
InsertTailList(&Ccb->ReadRequestListHead, &Context->ListEntry);
|
||||
if (Ccb->ReadRequestListHead.Flink != &Context->ListEntry)
|
||||
|
@ -454,6 +455,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
Status = STATUS_PIPE_BROKEN;
|
||||
break;
|
||||
}
|
||||
KeResetEvent(&Ccb->ReadEvent);
|
||||
ExReleaseFastMutex(&Ccb->DataListLock);
|
||||
|
||||
if (IoIsOperationSynchronous(Irp))
|
||||
|
@ -537,7 +539,6 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
KeResetEvent(&Ccb->ReadEvent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -638,8 +639,6 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
else
|
||||
{
|
||||
KeResetEvent(&Ccb->ReadEvent);
|
||||
|
||||
if ((Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) && (Ccb->WriteQuotaAvailable > 0) && (Ccb->OtherSide))
|
||||
{
|
||||
KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE);
|
||||
|
@ -831,6 +830,7 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
goto done;
|
||||
}
|
||||
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
||||
KeResetEvent(&Ccb->WriteEvent);
|
||||
ExReleaseFastMutex(&ReaderCcb->DataListLock);
|
||||
|
||||
DPRINT("Write Waiting for buffer space (%wZ)\n", &Fcb->PipeName);
|
||||
|
@ -908,7 +908,6 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
if (Length == 0)
|
||||
{
|
||||
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
||||
KeResetEvent(&Ccb->WriteEvent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -961,7 +960,6 @@ NpfsWrite(PDEVICE_OBJECT DeviceObject,
|
|||
if (Information > 0)
|
||||
{
|
||||
KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE);
|
||||
KeResetEvent(&Ccb->WriteEvent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue