Author: cgutman Date: Fri May 28 01:52:32 2010 New Revision: 47375
URL: http://svn.reactos.org/svn/reactos?rev=47375&view=rev Log: [NPFS] - Partially revert r47370 and apply a better patch - Change ReadEvent and WriteEvent to notification events because we reset those events manually when we run out of buffer space
Modified: trunk/reactos/drivers/filesystems/npfs/create.c trunk/reactos/drivers/filesystems/npfs/rw.c
Modified: trunk/reactos/drivers/filesystems/npfs/create.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/cr... ============================================================================== --- trunk/reactos/drivers/filesystems/npfs/create.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/npfs/create.c [iso-8859-1] Fri May 28 01:52:32 2010 @@ -205,8 +205,8 @@ ClientCcb->MaxDataLength = Fcb->OutboundQuota; ExInitializeFastMutex(&ClientCcb->DataListLock); KeInitializeEvent(&ClientCcb->ConnectEvent, SynchronizationEvent, FALSE); - KeInitializeEvent(&ClientCcb->ReadEvent, SynchronizationEvent, FALSE); - KeInitializeEvent(&ClientCcb->WriteEvent, SynchronizationEvent, FALSE); + KeInitializeEvent(&ClientCcb->ReadEvent, NotificationEvent, FALSE); + KeInitializeEvent(&ClientCcb->WriteEvent, NotificationEvent, FALSE);
/* @@ -540,8 +540,8 @@ DPRINT("CCB: %p\n", Ccb);
KeInitializeEvent(&Ccb->ConnectEvent, SynchronizationEvent, FALSE); - KeInitializeEvent(&Ccb->ReadEvent, SynchronizationEvent, FALSE); - KeInitializeEvent(&Ccb->WriteEvent, SynchronizationEvent, FALSE); + KeInitializeEvent(&Ccb->ReadEvent, NotificationEvent, FALSE); + KeInitializeEvent(&Ccb->WriteEvent, NotificationEvent, FALSE);
KeLockMutex(&Fcb->CcbListLock); InsertTailList(&Fcb->ServerCcbListHead, &Ccb->CcbListEntry); @@ -619,7 +619,6 @@ ExAcquireFastMutex(&OtherSide->DataListLock); ExAcquireFastMutex(&Ccb->DataListLock); } - OtherSide->PipeState = FILE_PIPE_CLOSING_STATE; OtherSide->OtherSide = NULL; /* * Signaling the write event. If is possible that an other @@ -745,7 +744,6 @@ /* Disconnect the pipes */ if (Ccb->OtherSide) { - Ccb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE; Ccb->OtherSide->OtherSide = NULL; Ccb->OtherSide = NULL; }
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] Fri May 28 01:52:32 2010 @@ -331,11 +331,8 @@
if ((Ccb->OtherSide == NULL) && (Ccb->ReadDataAvailable == 0)) { - if (Ccb->PipeState == FILE_PIPE_CLOSING_STATE) - { - DPRINT("File pipe broken\n"); + if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) Status = STATUS_PIPE_BROKEN; - } else if (Ccb->PipeState == FILE_PIPE_LISTENING_STATE) Status = STATUS_PIPE_LISTENING; else if (Ccb->PipeState == FILE_PIPE_DISCONNECTED_STATE) @@ -443,7 +440,7 @@ { break; } - if ((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) && (Ccb->ReadDataAvailable == 0)) + if (((Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) || (!Ccb->OtherSide)) && (Ccb->ReadDataAvailable == 0)) { DPRINT("PipeState: %x\n", Ccb->PipeState); Status = STATUS_PIPE_BROKEN; @@ -800,13 +797,13 @@ { if ((ReaderCcb->WriteQuotaAvailable == 0)) { - KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); - if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) + if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide) { Status = STATUS_PIPE_BROKEN; ExReleaseFastMutex(&ReaderCcb->DataListLock); goto done; } + KeSetEvent(&ReaderCcb->ReadEvent, IO_NO_INCREMENT, FALSE); ExReleaseFastMutex(&ReaderCcb->DataListLock);
DPRINT("Write Waiting for buffer space (%S)\n", Fcb->PipeName.Buffer); @@ -830,20 +827,15 @@ * It's possible that the event was signaled because the * other side of pipe was closed. */ - if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE) + if (Ccb->PipeState != FILE_PIPE_CONNECTED_STATE || !Ccb->OtherSide) { DPRINT("PipeState: %x\n", Ccb->PipeState); Status = STATUS_PIPE_BROKEN; goto done; } /* Check that the pipe has not been closed */ - if (ReaderCcb->PipeState != FILE_PIPE_CONNECTED_STATE) - { - /* If the other side is valid, fire event */ - if (Ccb) - { - KeResetEvent(&Ccb->WriteEvent); - } + if (ReaderCcb->PipeState != FILE_PIPE_CONNECTED_STATE || !ReaderCcb->OtherSide) + { Status = STATUS_PIPE_BROKEN; goto done; }