- Implemented RxCompleteSrvOpenKeyAssociation(), RxInitiateSrvOpenKeyAssociation(), RxProcessChangeBufferingStateRequests()
- Implemented RxFinalizeFcbTable(), RxFinalizeNetFobx(), RxFinalizeNetRoot(), RxFinalizeSrvCall(), RxFinalizeVNetRoot(), RxFreeObject(), RxpDestroySrvCall(), RxRemovePrefixTableEntry(), RxRemoveVirtualNetRootFromNetRoot(), RxScavengeRelatedFobxs(), RxTearDownBufferingManager(), RxUndoScavengerFinalizationMarking()
- Implemented RxPostToWorkerThread()
- Implemented RxFlushFcbInSystemCache(), RxPurgeFcb(), RxPurgeFcbInSystemCache()
- Stubbed RxOrphanSrvOpens(), RxpDiscardChangeBufferingStateRequests(), RxpDispatchChangeBufferingStateRequests(), RxpProcessChangeBufferingStateRequests()
- Continued implementation of RxDereference() so that it supports more objects than just SRV_CALL
- Reworked RxInsertWorkQueueItem() implementation so that it accepts any work item, and not just dispatch work items
- Finished implementation of RxTableLookupName() so that it properly returns a V_NET_ROOT on NET_ROOT match

Notable effects of this commit are:
- RXCE/RDBSS leak less memory; now objects without references are properly deleted from the system
- This means that stale objects are also deleted; this fixes CORE-13483 were same stale SRV_CALL was used again and again
- Because in prefix table NET_ROOT are correctly handled, it's now possible to mount several path from the same prefix; this fixes CORE-13482

CORE-8204
CORE-11327
CORE-13482
CORE-13483

svn path=/trunk/; revision=75195
This commit is contained in:
Pierre Schweitzer 2017-06-25 11:55:37 +00:00
parent db0b0e9ee3
commit 81eba8d3e7
8 changed files with 1031 additions and 30 deletions

View file

@ -22,6 +22,29 @@ typedef struct _RX_BUFFERING_MANAGER_
LIST_ENTRY SrvOpenLists[1];
} RX_BUFFERING_MANAGER, *PRX_BUFFERING_MANAGER;
#if (_WIN32_WINNT >= 0x0600)
#define RxAcquireBufferingManagerMutex(BufMan) ExAcquireFastMutex(&(BufMan)->Mutex)
#else
#define RxAcquireBufferingManagerMutex(BufMan) \
{ \
if (!ExTryToAcquireFastMutex(&(BufMan)->Mutex)) \
{ \
ExAcquireFastMutex(&(BufMan)->Mutex); \
} \
}
#endif
#define RxReleaseBufferingManagerMutex(BufMan) ExReleaseFastMutex(&(BufMan)->Mutex)
VOID
RxpProcessChangeBufferingStateRequests(
PSRV_CALL SrvCall,
BOOLEAN UpdateHandlerState);
VOID
NTAPI
RxProcessChangeBufferingStateRequests(
_In_ PVOID SrvCall);
VOID
RxProcessFcbChangeBufferingStateRequest(
_In_ PFCB Fcb);
@ -38,6 +61,15 @@ NTSTATUS
RxInitializeBufferingManager(
_In_ PSRV_CALL SrvCall);
NTSTATUS
RxTearDownBufferingManager(
_In_ PSRV_CALL SrvCall);
NTSTATUS
RxFlushFcbInSystemCache(
_In_ PFCB Fcb,
_In_ BOOLEAN SynchronizeWithLazyWriter);
NTSTATUS
RxPurgeFcbInSystemCache(
_In_ PFCB Fcb,

View file

@ -27,6 +27,9 @@ typedef struct _SRV_CALL
RX_BUFFERING_MANAGER BufferingManager;
} SRV_CALL, *PSRV_CALL;
#define NETROOT_FLAG_FINALIZATION_IN_PROGRESS 0x00040000
#define NETROOT_FLAG_NAME_ALREADY_REMOVED 0x00080000
typedef struct _NET_ROOT
{
union
@ -270,6 +273,7 @@ typedef struct _SRV_OPEN
#define FOBX_FLAG_MATCH_ALL 0x10000
#define FOBX_FLAG_FREE_UNICODE 0x20000
#define FOBX_FLAG_DELETE_ON_CLOSE 0x800000
#define FOBX_FLAG_SRVOPEN_CLOSED 0x1000000
#define FOBX_FLAG_UNC_NAME 0x2000000
#define FOBX_FLAG_ENCLOSED_ALLOCATED 0x4000000
@ -463,6 +467,12 @@ RxCreateVNetRoot(
_In_ PUNICODE_STRING FilePath,
_In_ PRX_CONNECTION_ID RxConnectionId);
BOOLEAN
RxFinalizeVNetRoot(
_Out_ PV_NET_ROOT ThisVNetRoot,
_In_ BOOLEAN RecursiveFinalize,
_In_ BOOLEAN ForceFinalize);
#define RxWaitForStableVNetRoot(V, R) RxWaitForStableCondition(&(V)->Condition, &(V)->TransitionWaitList, (R), NULL)
#define RxTransitionVNetRoot(V, C) RxUpdateCondition((C), &(V)->Condition, &(V)->TransitionWaitList)
@ -578,6 +588,12 @@ RxCreateNetFobx(
_Out_ PRX_CONTEXT RxContext,
_In_ PMRX_SRV_OPEN MrxSrvOpen);
BOOLEAN
RxFinalizeNetFobx(
_Out_ PFOBX ThisFobx,
_In_ BOOLEAN RecursiveFinalize,
_In_ BOOLEAN ForceFinalize);
#ifdef __REACTOS__
#define FILL_IN_FCB(Fcb, a, nl, ct, lat, lwt, lct, as, fs, vdl) \
(Fcb)->Attributes = a; \

View file

@ -32,6 +32,10 @@ RxInitializeFcbTable(
_Inout_ PRX_FCB_TABLE FcbTable,
_In_ BOOLEAN CaseInsensitiveMatch);
VOID
RxFinalizeFcbTable(
_Inout_ PRX_FCB_TABLE FcbTable);
PFCB
RxFcbTableLookupFcb(
_In_ PRX_FCB_TABLE FcbTable,

View file

@ -11,6 +11,7 @@ typedef struct _MRX_NORMAL_NODE_HEADER
#define SRVCALL_FLAG_CASE_INSENSITIVE_NETROOTS 0x4
#define SRVCALL_FLAG_CASE_INSENSITIVE_FILENAMES 0x8
#define SRVCALL_FLAG_DFS_AWARE_SERVER 0x10
#define SRVCALL_FLAG_FORCE_FINALIZED 0x20
typedef struct _MRX_SRV_CALL_
{

View file

@ -30,6 +30,11 @@ RxPrefixTableInsertName(
_In_ USHORT CaseInsensitiveLength,
_In_ PRX_CONNECTION_ID ConnectionId);
VOID
RxRemovePrefixTableEntry(
_Inout_ PRX_PREFIX_TABLE ThisTable,
_Inout_ PRX_PREFIX_ENTRY Entry);
VOID
RxInitializePrefixTable(
_Inout_ PRX_PREFIX_TABLE ThisTable,

View file

@ -528,6 +528,14 @@ ULONG
RxGetNetworkProviderPriority(
_In_ PUNICODE_STRING DeviceName);
VOID
RxpDiscardChangeBufferingStateRequests(
_Inout_ PLIST_ENTRY DiscardedRequests);
VOID
RxUndoScavengerFinalizationMarking(
PVOID Instance);
ULONG
RxTableComputePathHashValue(
_In_ PUNICODE_STRING Name);
@ -563,6 +571,11 @@ RxAddVirtualNetRootToNetRoot(
_In_ PNET_ROOT NetRoot,
_In_ PV_NET_ROOT VNetRoot);
VOID
RxRemoveVirtualNetRootFromNetRoot(
_In_ PNET_ROOT NetRoot,
_In_ PV_NET_ROOT VNetRoot);
PVOID
RxAllocateFcbObject(
_In_ PRDBSS_DEVICE_OBJECT RxDeviceObject,
@ -575,6 +588,10 @@ VOID
RxFreeFcbObject(
_In_ PVOID Object);
VOID
RxPurgeFcb(
_In_ PFCB Fcb);
BOOLEAN
RxFinalizeNetFcb(
_Out_ PFCB ThisFcb,
@ -641,6 +658,10 @@ RxTableLookupName(
_Out_ PUNICODE_STRING RemainingName,
_In_opt_ PRX_CONNECTION_ID RxConnectionId);
VOID
RxOrphanSrvOpens(
_In_ PV_NET_ROOT ThisVNetRoot);
VOID
RxOrphanThisFcb(
_In_ PFCB Fcb);

View file

@ -80,6 +80,15 @@ typedef struct _RX_DISPATCHER_
KEVENT SpinUpRequestsTearDownEvent;
} RX_DISPATCHER, *PRX_DISPATCHER;
NTSTATUS
NTAPI
RxPostToWorkerThread(
_In_ PRDBSS_DEVICE_OBJECT pMRxDeviceObject,
_In_ WORK_QUEUE_TYPE WorkQueueType,
_In_ PRX_WORK_QUEUE_ITEM pWorkQueueItem,
_In_ PRX_WORKERTHREAD_ROUTINE Routine,
_In_ PVOID pContext);
NTSTATUS
NTAPI
RxDispatchToWorkerThread(

File diff suppressed because it is too large Load diff