Author: cgutman
Date: Sun Nov 6 23:40:06 2011
New Revision: 54325
URL:
http://svn.reactos.org/svn/reactos?rev=54325&view=rev
Log:
[NPFS]
- Make the initial NpfsRead wait uninterruptible since it's really being used like a
mutex (avoid the kernel stack being paged out during the wait causing memory corruption)
- Handle interrupted waits that were missed in certain cases
- Fix a potential deadlock that would happen if more I/O was done on a file object after
the previous operation was interrupted by an APC or alert
Modified:
trunk/reactos/drivers/filesystems/npfs/fsctrl.c
trunk/reactos/drivers/filesystems/npfs/rw.c
Modified: trunk/reactos/drivers/filesystems/npfs/fsctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/fsctrl.c [iso-8859-1] Sun Nov 6 23:40:06 2011
@@ -183,11 +183,13 @@
if (Flags & FO_SYNCHRONOUS_IO)
{
- KeWaitForSingleObject(&Ccb->ConnectEvent,
+ Status = KeWaitForSingleObject(&Ccb->ConnectEvent,
UserRequest,
Irp->RequestorMode,
(Flags & FO_ALERTABLE_IO),
NULL);
+ if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status ==
STATUS_ALERTED))
+ Status = STATUS_CANCELLED;
}
DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status);
@@ -403,11 +405,13 @@
TimeOut = NULL;
}
- Status = KeWaitForSingleObject(&Ccb->ConnectEvent,
- UserRequest,
- Irp->RequestorMode,
- (Ccb->FileObject->Flags &
FO_ALERTABLE_IO),
- TimeOut);
+ Status = KeWaitForSingleObject(&Ccb->ConnectEvent,
+ UserRequest,
+ Irp->RequestorMode,
+ (Ccb->FileObject->Flags & FO_ALERTABLE_IO),
+ TimeOut);
+ if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status ==
STATUS_ALERTED))
+ Status = STATUS_CANCELLED;
DPRINT("KeWaitForSingleObject() returned (Status %lx)\n", Status);
@@ -526,6 +530,8 @@
Irp->RequestorMode,
(Ccb->FileObject->Flags & FO_ALERTABLE_IO),
&TimeOut);
+ if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status ==
STATUS_ALERTED))
+ Status = STATUS_CANCELLED;
DPRINT("KeWaitForSingleObject() returned (Status %lx)\n", Status);
Modified: trunk/reactos/drivers/filesystems/npfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/r…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/rw.c [iso-8859-1] Sun Nov 6 23:40:06 2011
@@ -373,20 +373,11 @@
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
Context->WaitEvent = &Event;
ExReleaseFastMutex(&Ccb->DataListLock);
- Status = KeWaitForSingleObject(&Event,
- UserRequest,
- Irp->RequestorMode,
- (FileObject->Flags & FO_ALERTABLE_IO),
+ KeWaitForSingleObject(&Event,
+ Executive,
+ KernelMode,
+ FALSE,
NULL);
- if ((Status == STATUS_USER_APC) || (Status == STATUS_KERNEL_APC) || (Status
== STATUS_ALERTED))
- {
- Status = STATUS_CANCELLED;
- goto done;
- }
- if (!NT_SUCCESS(Status))
- {
- ASSERT(FALSE);
- }
ExAcquireFastMutex(&Ccb->DataListLock);
}
Irp->IoStatus.Information = 0;
@@ -661,9 +652,6 @@
Irp->IoStatus.Status = Status;
ASSERT(IoGetCurrentIrpStackLocation(Irp)->FileObject != NULL);
-
- if (Status == STATUS_CANCELLED)
- goto done;
if (IoIsOperationSynchronous(Irp))
{