Author: tfaber Date: Sat Sep 29 11:20:25 2012 New Revision: 57424
URL: http://svn.reactos.org/svn/reactos?rev=57424&view=rev Log: [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).
Modified: trunk/reactos/drivers/filesystems/npfs/rw.c
Modified: trunk/reactos/drivers/filesystems/npfs/rw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/rw... ============================================================================== --- trunk/reactos/drivers/filesystems/npfs/rw.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/npfs/rw.c [iso-8859-1] Sat Sep 29 11:20:25 2012 @@ -393,6 +393,7 @@ { /* 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 @@ Status = STATUS_PIPE_BROKEN; break; } + KeResetEvent(&Ccb->ReadEvent); ExReleaseFastMutex(&Ccb->DataListLock);
if (IoIsOperationSynchronous(Irp)) @@ -537,7 +539,6 @@ { KeSetEvent(&Ccb->OtherSide->WriteEvent, IO_NO_INCREMENT, FALSE); } - KeResetEvent(&Ccb->ReadEvent); break; } } @@ -638,8 +639,6 @@ } 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 @@ 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 @@ if (Length == 0) { KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); - KeResetEvent(&Ccb->WriteEvent); break; } } @@ -961,7 +960,6 @@ if (Information > 0) { KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); - KeResetEvent(&Ccb->WriteEvent); break; } }