Author: ion
Date: Wed Sep 11 17:10:30 2013
New Revision: 60034
URL:
http://svn.reactos.org/svn/reactos?rev=60034&view=rev
Log:
[NPFS-NEW]: Use locking and IRP completion macros from NPFS snippet at "Common Driver
Reliability Issues - Microsoft
download.microsoft.com/download/5/7/7/577a5684-8a83.../drvqa.doc"quot;. Fix a few
incorrect exclusive vs shared lock acquires.
Modified:
trunk/reactos/drivers/filesystems/npfs_new/cleanup.c
trunk/reactos/drivers/filesystems/npfs_new/close.c
trunk/reactos/drivers/filesystems/npfs_new/create.c
trunk/reactos/drivers/filesystems/npfs_new/datasup.c
trunk/reactos/drivers/filesystems/npfs_new/fileinfo.c
trunk/reactos/drivers/filesystems/npfs_new/flushbuf.c
trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c
trunk/reactos/drivers/filesystems/npfs_new/main.c
trunk/reactos/drivers/filesystems/npfs_new/npfs.h
trunk/reactos/drivers/filesystems/npfs_new/read.c
trunk/reactos/drivers/filesystems/npfs_new/seinfo.c
trunk/reactos/drivers/filesystems/npfs_new/statesup.c
trunk/reactos/drivers/filesystems/npfs_new/write.c
Modified: trunk/reactos/drivers/filesystems/npfs_new/cleanup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/cleanup.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/cleanup.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -7,18 +7,16 @@
{
PIO_STACK_LOCATION IoStack;
NODE_TYPE_CODE NodeTypeCode;
- LIST_ENTRY List;
+ LIST_ENTRY DeferredList;
PNP_FCB Fcb;
PNP_CCB Ccb;
ULONG NamedPipeEnd;
- PLIST_ENTRY ThisEntry, NextEntry;
- PIRP LocalIrp;
PAGED_CODE();
IoStack = IoGetCurrentIrpStackLocation(Irp);
- InitializeListHead(&List);
+ InitializeListHead(&DeferredList);
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
(PVOID*)&Fcb,
&Ccb,
@@ -31,20 +29,11 @@
--Ccb->Fcb->ServerOpenCount;
}
- NpSetClosingPipeState(Ccb, Irp, NamedPipeEnd, &List);
+ NpSetClosingPipeState(Ccb, Irp, NamedPipeEnd, &DeferredList);
}
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
- }
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/filesystems/npfs_new/close.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/close.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/close.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -7,18 +7,16 @@
{
PIO_STACK_LOCATION IoStack;
NODE_TYPE_CODE NodeTypeCode;
- LIST_ENTRY List;
+ LIST_ENTRY DeferredList;
PNP_FCB Fcb;
PNP_CCB Ccb;
ULONG NamedPipeEnd;
- PLIST_ENTRY ThisEntry, NextEntry;
- PIRP LocalIrp;
PAGED_CODE();
IoStack = IoGetCurrentIrpStackLocation(Irp);
- InitializeListHead(&List);
+ InitializeListHead(&DeferredList);
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
NodeTypeCode = NpDecodeFileObject(IoStack->FileObject,
(PVOID*)&Fcb,
&Ccb,
@@ -26,24 +24,15 @@
if (NodeTypeCode == NPFS_NTC_ROOT_DCB)
{
--Fcb->CurrentInstances;
- NpDeleteCcb(Ccb, &List);
+ NpDeleteCcb(Ccb, &DeferredList);
}
else if (NodeTypeCode == NPFS_NTC_VCB)
{
--NpVcb->ReferenceCount;
}
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
- }
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
Modified: trunk/reactos/drivers/filesystems/npfs_new/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/create.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -205,12 +205,10 @@
PNP_FCB Fcb;
PNP_DCB Dcb;
ACCESS_MASK DesiredAccess;
- LIST_ENTRY List;
- PLIST_ENTRY NextEntry, ThisEntry;
+ LIST_ENTRY DeferredList;
UNICODE_STRING Prefix;
- PIRP ListIrp;
-
- InitializeListHead(&List);
+
+ InitializeListHead(&DeferredList);
IoStack = (PEXTENDED_IO_STACK_LOCATION)IoGetCurrentIrpStackLocation(Irp);
FileObject = IoStack->FileObject;
RelatedFileObject = FileObject->RelatedFileObject;
@@ -240,7 +238,7 @@
Irp->IoStatus = NpOpenNamedPipeRootDirectory(NpVcb->RootDcb,
FileObject,
DesiredAccess,
- &List);
+ &DeferredList);
goto Quickie;
}
}
@@ -255,7 +253,7 @@
Irp->IoStatus = NpOpenNamedPipeRootDirectory(NpVcb->RootDcb,
FileObject,
DesiredAccess,
- &List);
+ &DeferredList);
goto Quickie;
}
@@ -329,21 +327,11 @@
SL_FORCE_ACCESS_CHECK ?
UserMode : Irp->RequestorMode,
Irp->Tail.Overlay.Thread,
- &List);
+ &DeferredList);
Quickie:
ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- ListIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(ListIrp, IO_NAMED_PIPE_INCREMENT);
- }
-
+ NpCompleteDeferredIrps(&DeferredList);
FsRtlExitFileSystem();
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@@ -622,16 +610,14 @@
PFILE_OBJECT RelatedFileObject;
USHORT Disposition, ShareAccess;
PEPROCESS Process;
- LIST_ENTRY LocalList;
- PLIST_ENTRY NextEntry, ThisEntry;
+ LIST_ENTRY DeferredList;
UNICODE_STRING FileName;
PNP_FCB Fcb;
UNICODE_STRING Prefix;
PNAMED_PIPE_CREATE_PARAMETERS Parameters;
IO_STATUS_BLOCK IoStatus;
- PIRP ListIrp;
-
- InitializeListHead(&LocalList);
+
+ InitializeListHead(&DeferredList);
Process = IoGetRequestorProcess(Irp);
IoStack = (PEXTENDED_IO_STACK_LOCATION) IoGetCurrentIrpStackLocation(Irp);
@@ -650,7 +636,7 @@
IoStatus.Information = 0;
FsRtlEnterFileSystem();
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
if (RelatedFileObject)
{
@@ -701,7 +687,7 @@
ShareAccess,
Parameters,
Process,
- &LocalList,
+ &DeferredList,
&IoStatus);
goto Quickie;
}
@@ -731,21 +717,11 @@
ShareAccess,
Parameters,
Process,
- &LocalList);
+ &DeferredList);
Quickie:
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = LocalList.Flink;
- while (NextEntry != &LocalList)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- ListIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(ListIrp, IO_NAMED_PIPE_INCREMENT);
- }
-
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
FsRtlExitFileSystem();
Irp->IoStatus = IoStatus;
Modified: trunk/reactos/drivers/filesystems/npfs_new/datasup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/datasup.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/datasup.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -129,7 +129,7 @@
if (Irp && IoSetCancelRoutine(Irp, NULL))
{
- Irp->Tail.Overlay.DriverContext[3] = 0;
+ Irp->Tail.Overlay.DriverContext[3] = NULL;
}
ExFreePool(QueueEntry);
@@ -188,15 +188,13 @@
{
PNP_DATA_QUEUE DataQueue;
PNP_DATA_QUEUE_ENTRY DataEntry;
- LIST_ENTRY List;
+ LIST_ENTRY DeferredList;
PSECURITY_CLIENT_CONTEXT ClientSecurityContext;
BOOLEAN CompleteWrites, FirstEntry;
- PLIST_ENTRY NextEntry, ThisEntry;
- PIRP LocalIrp;
if (DeviceObject) IoReleaseCancelSpinLock(Irp->CancelIrql);
- InitializeListHead(&List);
+ InitializeListHead(&DeferredList);
DataQueue = (PNP_DATA_QUEUE)Irp->Tail.Overlay.DriverContext[2];
ClientSecurityContext = NULL;
@@ -204,7 +202,7 @@
if (DeviceObject)
{
FsRtlEnterFileSystem();
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
}
DataEntry = (PNP_DATA_QUEUE_ENTRY)Irp->Tail.Overlay.DriverContext[3];
@@ -245,18 +243,18 @@
{
if (FirstEntry)
{
- NpGetNextRealDataQueueEntry(DataQueue, &List);
+ NpGetNextRealDataQueueEntry(DataQueue, &DeferredList);
}
if (CompleteWrites)
{
- NpCompleteStalledWrites(DataQueue, &List);
+ NpCompleteStalledWrites(DataQueue, &DeferredList);
}
}
}
if (DeviceObject)
{
- ExReleaseResourceLite(&NpVcb->Lock);
+ NpReleaseVcb();
FsRtlExitFileSystem();
}
@@ -266,15 +264,7 @@
Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
- }
+ NpCompleteDeferredIrps(&DeferredList);
}
NTSTATUS
Modified: trunk/reactos/drivers/filesystems/npfs_new/fileinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/fileinfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/fileinfo.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -100,30 +100,18 @@
IN PIRP Irp)
{
NTSTATUS Status;
- LIST_ENTRY List;
- PLIST_ENTRY NextEntry, ThisEntry;
- PIRP LocalIrp;
- PAGED_CODE();
-
- InitializeListHead(&List);
+ LIST_ENTRY DeferredList;
+ PAGED_CODE();
+
+ InitializeListHead(&DeferredList);
FsRtlEnterFileSystem();
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
-
- Status = NpCommonSetInformation(DeviceObject, Irp, &List);
-
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
- }
-
+ NpAcquireExclusiveVcb();
+
+ Status = NpCommonSetInformation(DeviceObject, Irp, &DeferredList);
+
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
FsRtlExitFileSystem();
if (Status != STATUS_PENDING)
@@ -462,11 +450,11 @@
PAGED_CODE();
FsRtlEnterFileSystem();
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+ NpAcquireSharedVcb();
Status = NpCommonQueryInformation(DeviceObject, Irp);
- ExReleaseResourceLite(&NpVcb->Lock);
+ NpReleaseVcb();
FsRtlExitFileSystem();
if (Status != STATUS_PENDING)
Modified: trunk/reactos/drivers/filesystems/npfs_new/flushbuf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/flushbuf.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/flushbuf.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -59,11 +59,11 @@
PAGED_CODE();
FsRtlEnterFileSystem();
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireSharedVcb();
Status = NpCommonFlushBuffers(DeviceObject, Irp);
- ExReleaseResourceLite(&NpVcb->Lock);
+ NpReleaseVcb();
FsRtlExitFileSystem();
return Status;
Modified: trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -569,35 +569,33 @@
{
ULONG Fsctl;
BOOLEAN Overflow = FALSE;
- LIST_ENTRY List;
- PLIST_ENTRY NextEntry, ThisEntry;
+ LIST_ENTRY DeferredList;
NTSTATUS Status;
- PIRP LocalIrp;
- PAGED_CODE();
-
- InitializeListHead(&List);
+ PAGED_CODE();
+
+ InitializeListHead(&DeferredList);
Fsctl =
IoGetCurrentIrpStackLocation(Irp)->Parameters.FileSystemControl.FsControlCode;
switch (Fsctl)
{
case FSCTL_PIPE_PEEK:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
- Status = NpPeek(DeviceObject, Irp, &List);
+ NpAcquireExclusiveVcb();
+ Status = NpPeek(DeviceObject, Irp, &DeferredList);
break;
case FSCTL_PIPE_INTERNAL_WRITE:
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
- Status = NpInternalWrite(DeviceObject, Irp, &List);
+ NpAcquireSharedVcb();
+ Status = NpInternalWrite(DeviceObject, Irp, &DeferredList);
break;
case FSCTL_PIPE_TRANSCEIVE:
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
- Status = NpTransceive(DeviceObject, Irp, &List);
+ NpAcquireSharedVcb();
+ Status = NpTransceive(DeviceObject, Irp, &DeferredList);
break;
case FSCTL_PIPE_INTERNAL_TRANSCEIVE:
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
- Status = NpInternalTransceive(DeviceObject, Irp, &List);
+ NpAcquireSharedVcb();
+ Status = NpInternalTransceive(DeviceObject, Irp, &DeferredList);
break;
case FSCTL_PIPE_INTERNAL_READ_OVFLOW:
@@ -605,54 +603,54 @@
// on purpose
case FSCTL_PIPE_INTERNAL_READ:
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
- Status = NpInternalRead(DeviceObject, Irp, Overflow, &List);
+ NpAcquireSharedVcb();
+ Status = NpInternalRead(DeviceObject, Irp, Overflow, &DeferredList);
break;
case FSCTL_PIPE_QUERY_CLIENT_PROCESS:
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+ NpAcquireSharedVcb();
Status = NpQueryClientProcess(DeviceObject, Irp);
break;
case FSCTL_PIPE_ASSIGN_EVENT:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpAssignEvent(DeviceObject, Irp);
break;
case FSCTL_PIPE_DISCONNECT:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
- Status = NpDisconnect(DeviceObject, Irp, &List);
+ NpAcquireExclusiveVcb();
+ Status = NpDisconnect(DeviceObject, Irp, &DeferredList);
break;
case FSCTL_PIPE_LISTEN:
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
- Status = NpListen(DeviceObject, Irp, &List);
+ NpAcquireSharedVcb();
+ Status = NpListen(DeviceObject, Irp, &DeferredList);
break;
case FSCTL_PIPE_QUERY_EVENT:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpQueryEvent(DeviceObject, Irp);
break;
case FSCTL_PIPE_WAIT:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpWaitForNamedPipe(DeviceObject, Irp);
break;
case FSCTL_PIPE_IMPERSONATE:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpImpersonate(DeviceObject, Irp);
break;
case FSCTL_PIPE_SET_CLIENT_PROCESS:
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpSetClientProcess(DeviceObject, Irp);
break;
@@ -660,17 +658,8 @@
return STATUS_NOT_SUPPORTED;
}
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
- }
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
return Status;
}
Modified: trunk/reactos/drivers/filesystems/npfs_new/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/main.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -40,8 +40,8 @@
DriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = NpFsdFlushBuffers;
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] = NpFsdDirectoryControl;
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] = NpFsdFileSystemControl;
- DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = NpFsdQuerySecurity;
- DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] = NpFsdSetSecurity;
+ DriverObject->MajorFunction[IRP_MJ_QUERY_SECURITY] = NpFsdQuerySecurityInfo;
+ DriverObject->MajorFunction[IRP_MJ_SET_SECURITY] = NpFsdSetSecurityInfo;
DriverObject->DriverUnload = NULL;
Modified: trunk/reactos/drivers/filesystems/npfs_new/npfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/npfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/npfs.h [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -263,6 +263,60 @@
extern PNP_VCB NpVcb;
+//
+// Functions to lock/unlock the global VCB lock
+//
+FORCEINLINE
+VOID
+NpAcquireSharedVcb(VOID)
+{
+ /* Acquire the lock in shared mode */
+ ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+}
+
+FORCEINLINE
+VOID
+NpAcquireExclusiveVcb(VOID)
+{
+ /* Acquire the lock in exclusive mode */
+ ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+}
+
+FORCEINLINE
+VOID
+NpReleaseVcb(VOID)
+{
+ /* Release the lock */
+ ExReleaseResourceLite(&NpVcb->Lock);
+}
+
+//
+// Function to process deferred IRPs outside the VCB lock but still within the
+// critical region
+//
+VOID
+FORCEINLINE
+NpCompleteDeferredIrps(IN PLIST_ENTRY DeferredList)
+{
+ PLIST_ENTRY ThisEntry, NextEntry;
+ PIRP Irp;
+
+ /* Loop the list */
+ ThisEntry = DeferredList->Flink;
+ while (ThisEntry != DeferredList)
+ {
+ /* Remember the next entry, but don't switch to it yet */
+ NextEntry = ThisEntry->Flink;
+
+ /* Complete the IRP for this entry */
+ Irp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
+ IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
+
+ /* And now switch to the next one */
+ ThisEntry = NextEntry;
+ }
+}
+
BOOLEAN
NTAPI
NpDeleteEventTableEntry(IN PRTL_GENERIC_TABLE Table,
@@ -533,13 +587,13 @@
NTSTATUS
NTAPI
-NpFsdQuerySecurity(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp);
-
-NTSTATUS
-NTAPI
-NpFsdSetSecurity(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp);
+NpFsdQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
+NTSTATUS
+NTAPI
+NpFsdSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
NTSTATUS
NTAPI
Modified: trunk/reactos/drivers/filesystems/npfs_new/read.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/read.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/read.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -142,37 +142,25 @@
{
PIO_STACK_LOCATION IoStack;
IO_STATUS_BLOCK IoStatus;
- LIST_ENTRY List;
- PLIST_ENTRY NextEntry, ThisEntry;
- PIRP LocalIrp;
+ LIST_ENTRY DeferredList;
PAGED_CODE();
NpSlowReadCalls++;
- InitializeListHead(&List);
+ InitializeListHead(&DeferredList);
IoStack = IoGetCurrentIrpStackLocation(Irp);
FsRtlEnterFileSystem();
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+ NpAcquireSharedVcb();
NpCommonRead(IoStack->FileObject,
Irp->UserBuffer,
IoStack->Parameters.Read.Length,
&IoStatus,
Irp,
- &List);
+ &DeferredList);
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- LocalIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(LocalIrp, IO_NAMED_PIPE_INCREMENT);
- }
-
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
FsRtlExitFileSystem();
if (IoStatus.Status != STATUS_PENDING)
Modified: trunk/reactos/drivers/filesystems/npfs_new/seinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/seinfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/seinfo.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -78,18 +78,18 @@
NTSTATUS
NTAPI
-NpFsdQuerySecurity(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+NpFsdQuerySecurityInfo(IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
{
NTSTATUS Status;
PAGED_CODE();
FsRtlEnterFileSystem();
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpCommonQuerySecurityInfo(DeviceObject, Irp);
- ExReleaseResourceLite(&NpVcb->Lock);
+ NpReleaseVcb();
FsRtlExitFileSystem();
if (Status != STATUS_PENDING)
@@ -103,18 +103,18 @@
NTSTATUS
NTAPI
-NpFsdSetSecurity(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+NpFsdSetSecurityInfo(IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
{
NTSTATUS Status;
PAGED_CODE();
FsRtlEnterFileSystem();
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
Status = NpCommonQuerySecurityInfo(DeviceObject, Irp);
- ExReleaseResourceLite(&NpVcb->Lock);
+ NpReleaseVcb();
FsRtlExitFileSystem();
if (Status != STATUS_PENDING)
Modified: trunk/reactos/drivers/filesystems/npfs_new/statesup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/statesup.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/statesup.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -6,12 +6,12 @@
IN PIRP Irp)
{
FsRtlEnterFileSystem();
- ExAcquireResourceExclusiveLite(&NpVcb->Lock, TRUE);
+ NpAcquireExclusiveVcb();
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
FsRtlExitFileSystem();
- ExReleaseResourceLite(&NpVcb->Lock);
+ NpReleaseVcb();
Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(Irp, IO_NAMED_PIPE_INCREMENT);
Modified: trunk/reactos/drivers/filesystems/npfs_new/write.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/write.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/write.c [iso-8859-1] Wed Sep 11 17:10:30
2013
@@ -156,17 +156,15 @@
{
PIO_STACK_LOCATION IoStack;
IO_STATUS_BLOCK IoStatus;
- LIST_ENTRY List;
- PLIST_ENTRY NextEntry, ThisEntry;
- PIRP ListIrp;
+ LIST_ENTRY DeferredList;
PAGED_CODE();
NpSlowWriteCalls++;
- InitializeListHead(&List);
+ InitializeListHead(&DeferredList);
IoStack = IoGetCurrentIrpStackLocation(Irp);
FsRtlEnterFileSystem();
- ExAcquireResourceSharedLite(&NpVcb->Lock, TRUE);
+ NpAcquireSharedVcb();
NpCommonWrite(IoStack->FileObject,
Irp->UserBuffer,
@@ -174,20 +172,10 @@
Irp->Tail.Overlay.Thread,
&IoStatus,
Irp,
- &List);
+ &DeferredList);
- ExReleaseResourceLite(&NpVcb->Lock);
-
- NextEntry = List.Flink;
- while (NextEntry != &List)
- {
- ThisEntry = NextEntry;
- NextEntry = NextEntry->Flink;
-
- ListIrp = CONTAINING_RECORD(ThisEntry, IRP, Tail.Overlay.ListEntry);
- IoCompleteRequest(ListIrp, IO_NAMED_PIPE_INCREMENT);
- }
-
+ NpReleaseVcb();
+ NpCompleteDeferredIrps(&DeferredList);
FsRtlExitFileSystem();
if (IoStatus.Status != STATUS_PENDING)