Author: pschweitzer
Date: Sun Jul 30 07:58:25 2017
New Revision: 75441
URL:
http://svn.reactos.org/svn/reactos?rev=75441&view=rev
Log:
[RXCE]
- Implement RxAcquireFcbForLazyWrite(), RxAcquireFcbForReadAhead(),
RxReleaseFcbFromLazyWrite(), RxReleaseFcbFromReadAhead()
This makes RXCE better at dealing with Cc (and the other way round ;-)). This notably
avoids infinite acquire loops from Cc when writing on a NFS share.
CORE-8204
CORE-11327
Modified:
trunk/reactos/sdk/include/ddk/nodetype.h
trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c
trunk/reactos/sdk/lib/drivers/rxce/rxce.c
Modified: trunk/reactos/sdk/include/ddk/nodetype.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ddk/nodetype.h…
==============================================================================
--- trunk/reactos/sdk/include/ddk/nodetype.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/ddk/nodetype.h [iso-8859-1] Sun Jul 30 07:58:25 2017
@@ -63,6 +63,8 @@
#define RDBSS_NTC_NONPAGED_FCB ((NODE_TYPE_CODE)0xebfd)
#define RDBSS_NTC_MINIRDR_DISPATCH ((NODE_TYPE_CODE)0xebff)
+#define RDBSS_NTC_FCB RDBSS_NTC_STORAGE_TYPE_FILE
+
#define NodeTypeIsFcb(FCB) ((((NodeType(FCB) & 0xff00) ==
RDBSS_NTC_STORAGE_TYPE_UNKNOWN)) || ((NodeType(FCB) & 0xfff0) == 0xeb90))
#define RX_SCAVENGER_MASK (0x1000)
Modified: trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rdbsslib/r…
==============================================================================
--- trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/drivers/rdbsslib/rdbss.c [iso-8859-1] Sun Jul 30 07:58:25 2017
@@ -743,53 +743,6 @@
}
}
-NTSTATUS
-NTAPI
-RxAcquireExclusiveFcbResourceInMRx(
- _Inout_ PMRX_FCB Fcb)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-BOOLEAN
-NTAPI
-RxAcquireFcbForLazyWrite(
- PVOID Context,
- BOOLEAN Wait)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-BOOLEAN
-NTAPI
-RxAcquireFcbForReadAhead(
- PVOID Context,
- BOOLEAN Wait)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-VOID
-NTAPI
-RxAcquireFileForNtCreateSection(
- PFILE_OBJECT FileObject)
-{
- UNIMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-RxAcquireForCcFlush(
- PFILE_OBJECT FileObject,
- PDEVICE_OBJECT DeviceObject)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
/*
* @implemented
*/
@@ -8162,40 +8115,6 @@
return STATUS_SUCCESS;
}
-VOID
-NTAPI
-RxReleaseFcbFromLazyWrite(
- PVOID Context)
-{
- UNIMPLEMENTED;
-}
-
-VOID
-NTAPI
-RxReleaseFcbFromReadAhead(
- PVOID Context)
-{
- UNIMPLEMENTED;
-}
-
-VOID
-NTAPI
-RxReleaseFileForNtCreateSection(
- PFILE_OBJECT FileObject)
-{
- UNIMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-RxReleaseForCcFlush(
- PFILE_OBJECT FileObject,
- PDEVICE_OBJECT DeviceObject)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
/*
* @implemented
*/
Modified: trunk/reactos/sdk/lib/drivers/rxce/rxce.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/drivers/rxce/rxce.…
==============================================================================
--- trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] (original)
+++ trunk/reactos/sdk/lib/drivers/rxce/rxce.c [iso-8859-1] Sun Jul 30 07:58:25 2017
@@ -174,6 +174,118 @@
/* FUNCTIONS ****************************************************************/
+NTSTATUS
+NTAPI
+RxAcquireExclusiveFcbResourceInMRx(
+ _Inout_ PMRX_FCB Fcb)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+RxAcquireFcbForLazyWrite(
+ PVOID Context,
+ BOOLEAN Wait)
+{
+ PFCB Fcb;
+ BOOLEAN Ret;
+
+ PAGED_CODE();
+
+ Fcb = Context;
+ /* The received context is a FCB */
+ ASSERT(NodeType(Fcb) == RDBSS_NTC_FCB);
+ ASSERT_CORRECT_FCB_STRUCTURE(Fcb);
+ ASSERT(Fcb->Specific.Fcb.LazyWriteThread == NULL);
+
+ /* Acquire the paging resource (shared) */
+ Ret = ExAcquireResourceSharedLite(Fcb->Header.PagingIoResource, Wait);
+ if (Ret)
+ {
+ /* Update tracker information */
+ Fcb->PagingIoResourceFile = __FILE__;
+ Fcb->PagingIoResourceLine = __LINE__;
+ /* Lazy writer thread is the current one */
+ Fcb->Specific.Fcb.LazyWriteThread = PsGetCurrentThread();
+
+ /* There is no top level IRP */
+ ASSERT(RxIsThisTheTopLevelIrp(NULL));
+ /* Now, there will be! */
+ Ret = RxTryToBecomeTheTopLevelIrp(NULL, (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP,
+ Fcb->RxDeviceObject, TRUE);
+ /* In case of failure, release the lock and reset everything */
+ if (!Ret)
+ {
+ Fcb->PagingIoResourceFile = NULL;
+ Fcb->PagingIoResourceLine = 0;
+ ExReleaseResourceLite(Fcb->Header.PagingIoResource);
+ Fcb->Specific.Fcb.LazyWriteThread = NULL;
+ }
+ }
+
+ return Ret;
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+RxAcquireFcbForReadAhead(
+ PVOID Context,
+ BOOLEAN Wait)
+{
+ PFCB Fcb;
+ BOOLEAN Ret;
+
+ PAGED_CODE();
+
+ Fcb = Context;
+ /* The received context is a FCB */
+ ASSERT(NodeType(Fcb) == RDBSS_NTC_FCB);
+ ASSERT_CORRECT_FCB_STRUCTURE(Fcb);
+
+ Ret = ExAcquireResourceSharedLite(Fcb->Header.Resource, Wait);
+ if (Ret)
+ {
+ /* There is no top level IRP */
+ ASSERT(RxIsThisTheTopLevelIrp(NULL));
+ /* Now, there will be! */
+ Ret = RxTryToBecomeTheTopLevelIrp(NULL, (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP,
+ Fcb->RxDeviceObject, TRUE);
+ /* In case of failure, release the lock and reset everything */
+ if (!Ret)
+ {
+ ExReleaseResourceLite(Fcb->Header.Resource);
+ }
+ }
+
+ return Ret;
+}
+
+VOID
+NTAPI
+RxAcquireFileForNtCreateSection(
+ PFILE_OBJECT FileObject)
+{
+ UNIMPLEMENTED;
+}
+
+NTSTATUS
+NTAPI
+RxAcquireForCcFlush(
+ PFILE_OBJECT FileObject,
+ PDEVICE_OBJECT DeviceObject)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
/*
* @implemented
*/
@@ -7323,6 +7435,80 @@
* @implemented
*/
VOID
+NTAPI
+RxReleaseFcbFromLazyWrite(
+ PVOID Context)
+{
+ PFCB Fcb;
+
+ PAGED_CODE();
+
+ Fcb = Context;
+ /* The received context is a FCB */
+ ASSERT(NodeType(Fcb) == RDBSS_NTC_FCB);
+ ASSERT_CORRECT_FCB_STRUCTURE(Fcb);
+
+ /* Lazy writer is releasing lock, so forget about it */
+ Fcb->Specific.Fcb.LazyWriteThread = NULL;
+
+ /* If we were top level IRP, unwind */
+ if (RxGetTopIrpIfRdbssIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP)
+ {
+ RxUnwindTopLevelIrp(NULL);
+ }
+
+ /* And finally, release the lock */
+ Fcb->PagingIoResourceFile = NULL;
+ Fcb->PagingIoResourceLine = 0;
+ ExReleaseResourceLite(Fcb->Header.PagingIoResource);
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+RxReleaseFcbFromReadAhead(
+ PVOID Context)
+{
+ PFCB Fcb;
+
+ PAGED_CODE();
+
+ Fcb = Context;
+ /* The received context is a FCB */
+ ASSERT(NodeType(Fcb) == RDBSS_NTC_FCB);
+ ASSERT_CORRECT_FCB_STRUCTURE(Fcb);
+
+ /* Top Level IRP is CC */
+ ASSERT(RxGetTopIrpIfRdbssIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
+ RxUnwindTopLevelIrp(NULL);
+
+ ExReleaseResourceLite(Fcb->Header.Resource);
+}
+
+VOID
+NTAPI
+RxReleaseFileForNtCreateSection(
+ PFILE_OBJECT FileObject)
+{
+ UNIMPLEMENTED;
+}
+
+NTSTATUS
+NTAPI
+RxReleaseForCcFlush(
+ PFILE_OBJECT FileObject,
+ PDEVICE_OBJECT DeviceObject)
+{
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+/*
+ * @implemented
+ */
+VOID
RxRemoveNameNetFcb(
OUT PFCB ThisFcb)
{