From 7c79933df4fed6c8fee4456771c20e0c971f06aa Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 27 May 2010 00:26:34 +0000 Subject: [PATCH] [NPFS] - Change the other side's to PIPE_STATUS_CLOSING_STATE in NpfsCleanup and NpfsClose so the reading/writing thread knows that the pipe is dead when we signal its event - Fixes iphlpapi_winetest hang and possibly bug #4689 svn path=/trunk/; revision=47370 --- reactos/drivers/filesystems/npfs/create.c | 10 +++++++--- reactos/drivers/filesystems/npfs/rw.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/reactos/drivers/filesystems/npfs/create.c b/reactos/drivers/filesystems/npfs/create.c index 5236e2035ee..86209bdb8ab 100644 --- a/reactos/drivers/filesystems/npfs/create.c +++ b/reactos/drivers/filesystems/npfs/create.c @@ -619,7 +619,7 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, ExAcquireFastMutex(&OtherSide->DataListLock); ExAcquireFastMutex(&Ccb->DataListLock); } - //OtherSide->PipeState = FILE_PIPE_DISCONNECTED_STATE; + OtherSide->PipeState = FILE_PIPE_CLOSING_STATE; OtherSide->OtherSide = NULL; /* * Signaling the write event. If is possible that an other @@ -743,8 +743,12 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, } /* Disconnect the pipes */ - if (Ccb->OtherSide) Ccb->OtherSide->OtherSide = NULL; - if (Ccb) Ccb->OtherSide = NULL; + if (Ccb->OtherSide) + { + Ccb->OtherSide->PipeState = FILE_PIPE_CLOSING_STATE; + Ccb->OtherSide->OtherSide = NULL; + Ccb->OtherSide = NULL; + } ASSERT(Ccb->PipeState == FILE_PIPE_CLOSING_STATE); diff --git a/reactos/drivers/filesystems/npfs/rw.c b/reactos/drivers/filesystems/npfs/rw.c index 7b14449b308..4c83f5cec53 100644 --- a/reactos/drivers/filesystems/npfs/rw.c +++ b/reactos/drivers/filesystems/npfs/rw.c @@ -331,7 +331,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject, if ((Ccb->OtherSide == NULL) && (Ccb->ReadDataAvailable == 0)) { - if (Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) + if (Ccb->PipeState == FILE_PIPE_CLOSING_STATE) { DPRINT("File pipe broken\n"); Status = STATUS_PIPE_BROKEN; -- 2.17.1