[RDBSS]
[RXCE]
[DDK]
Add an initial implementation of the RXCE and RDBSS libraries that are used to implement mini-redirectors
The associated headers are also added to DDK
The implementation is partial (really!) and is only working for read-only operations.
It leaks memory as hell (no refcounting implemented) and thus, objects freeing is not implemented.
It was tested with NFS41 driver. With such RDBSS, it's possible for the driver to mount a remote share, to list
files, to query their properties, to query volume properties, and finally to read files (with some corruption under
specific conditions).
Please refrain from committing in this (especially for modifying whitespaces or fixing comments...), this is still WIP
and under development, it would mess with my local changes!
In itself, it doesn't bring anything to ReactOS yet, as no mini redirector is available in ReactOS source tree.
This may come later on with NFS41.
More to follow...
CORE-11327
svn path=/trunk/; revision=74674
2017-05-26 20:52:18 +00:00
|
|
|
#ifndef _SCAVENGR_H_
|
|
|
|
#define _SCAVENGR_H_
|
|
|
|
|
|
|
|
extern KMUTEX RxScavengerMutex;
|
|
|
|
|
|
|
|
#define RX_SCAVENGER_FINALIZATION_TIME_INTERVAL (10 * 1000 * 1000 * 10)
|
|
|
|
|
|
|
|
typedef struct _RX_SCAVENGER_ENTRY
|
|
|
|
{
|
|
|
|
LIST_ENTRY List;
|
|
|
|
UCHAR Type;
|
|
|
|
UCHAR Operation;
|
|
|
|
UCHAR State;
|
|
|
|
UCHAR Flags;
|
|
|
|
struct _RX_SCAVENGER_ENTRY *pContinuationEntry;
|
|
|
|
} RX_SCAVENGER_ENTRY, *PRX_SCAVENGER_ENTRY;
|
|
|
|
|
|
|
|
#define RxInitializeScavengerEntry(ScavengerEntry) \
|
|
|
|
(ScavengerEntry)->State = 0; \
|
|
|
|
(ScavengerEntry)->Flags = 0; \
|
|
|
|
(ScavengerEntry)->Type = 0; \
|
|
|
|
(ScavengerEntry)->Operation = 0; \
|
|
|
|
InitializeListHead(&(ScavengerEntry)->List); \
|
|
|
|
(ScavengerEntry)->pContinuationEntry = NULL
|
|
|
|
|
|
|
|
#define RxAcquireScavengerMutex() KeWaitForSingleObject(&RxScavengerMutex, Executive, KernelMode, FALSE, NULL)
|
|
|
|
#define RxReleaseScavengerMutex() KeReleaseMutex(&RxScavengerMutex, FALSE)
|
|
|
|
|
|
|
|
VOID
|
|
|
|
RxMarkFobxOnCleanup(
|
|
|
|
_In_ PFOBX pFobx,
|
|
|
|
_Out_ PBOOLEAN NeedPurge);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
RxMarkFobxOnClose(
|
|
|
|
_In_ PFOBX Fobx);
|
|
|
|
|
[RDBSS]
- Implement __RxWriteReleaseResources(), RxCommonWrite(), RxCompleteMdl(), RxGetTopIrpIfRdbssIrp(), RxLowIoWriteShell(), RxLowIoWriteShellCompletion()
- Finish implementation of RxCommonCleanup() so that it handles setting EOF on a file
- Finish implementation of RxCommonCreate() so that it handles sharing violations and attempts to scavenge open files
[RXCE]
- Implement RxpScavengeFobxs(), RxpTrackDereference(), RxpTrackReference(), RxPurgeFobx(), RxPurgeRelatedFobxs(), RxReinitializeContext(), RxSetFileSizeWithLock(), RxScavengeFobxsForNetRoot()
- Fix a bug in RxPrefixTableLookupName() where it was badly handling nodes in scavenger
This commits brings several improvments to the NFS driver.
First of all, now, the driver handles creating, extending and writing to files!
It also handles purging dormant opened files when a file opening fails because of a sharing violation
Finally, it also brings something to look at our references issues in RDBSS to help finding out why our FCB are never (or nearly) dereferenced
CORE-8204
CORE-11327
CORE-13581
svn path=/trunk/; revision=75398
2017-07-24 17:05:05 +00:00
|
|
|
NTSTATUS
|
|
|
|
RxPurgeRelatedFobxs(
|
|
|
|
PNET_ROOT NetRoot,
|
|
|
|
PRX_CONTEXT RxContext,
|
|
|
|
BOOLEAN AttemptFinalization,
|
|
|
|
PFCB PurgingFcb);
|
|
|
|
|
|
|
|
#define DONT_ATTEMPT_FINALIZE_ON_PURGE FALSE
|
|
|
|
#define ATTEMPT_FINALIZE_ON_PURGE TRUE
|
|
|
|
|
[RDBSS]
[RXCE]
[DDK]
Add an initial implementation of the RXCE and RDBSS libraries that are used to implement mini-redirectors
The associated headers are also added to DDK
The implementation is partial (really!) and is only working for read-only operations.
It leaks memory as hell (no refcounting implemented) and thus, objects freeing is not implemented.
It was tested with NFS41 driver. With such RDBSS, it's possible for the driver to mount a remote share, to list
files, to query their properties, to query volume properties, and finally to read files (with some corruption under
specific conditions).
Please refrain from committing in this (especially for modifying whitespaces or fixing comments...), this is still WIP
and under development, it would mess with my local changes!
In itself, it doesn't bring anything to ReactOS yet, as no mini redirector is available in ReactOS source tree.
This may come later on with NFS41.
More to follow...
CORE-11327
svn path=/trunk/; revision=74674
2017-05-26 20:52:18 +00:00
|
|
|
typedef enum _RDBSS_SCAVENGER_STATE
|
|
|
|
{
|
|
|
|
RDBSS_SCAVENGER_INACTIVE,
|
|
|
|
RDBSS_SCAVENGER_DORMANT,
|
|
|
|
RDBSS_SCAVENGER_ACTIVE,
|
|
|
|
RDBSS_SCAVENGER_SUSPENDED
|
|
|
|
} RDBSS_SCAVENGER_STATE, *PRDBSS_SCAVENGER_STATE;
|
|
|
|
|
|
|
|
typedef struct _RDBSS_SCAVENGER
|
|
|
|
{
|
|
|
|
RDBSS_SCAVENGER_STATE State;
|
|
|
|
LONG MaximumNumberOfDormantFiles;
|
|
|
|
volatile LONG NumberOfDormantFiles;
|
|
|
|
LARGE_INTEGER TimeLimit;
|
|
|
|
ULONG SrvCallsToBeFinalized;
|
|
|
|
ULONG NetRootsToBeFinalized;
|
|
|
|
ULONG VNetRootsToBeFinalized;
|
|
|
|
ULONG FcbsToBeFinalized;
|
|
|
|
ULONG SrvOpensToBeFinalized;
|
|
|
|
ULONG FobxsToBeFinalized;
|
|
|
|
LIST_ENTRY SrvCallFinalizationList;
|
|
|
|
LIST_ENTRY NetRootFinalizationList;
|
|
|
|
LIST_ENTRY VNetRootFinalizationList;
|
|
|
|
LIST_ENTRY FcbFinalizationList;
|
|
|
|
LIST_ENTRY SrvOpenFinalizationList;
|
|
|
|
LIST_ENTRY FobxFinalizationList;
|
|
|
|
LIST_ENTRY ClosePendingFobxsList;
|
|
|
|
RX_WORK_ITEM WorkItem;
|
|
|
|
KEVENT SyncEvent;
|
|
|
|
KEVENT ScavengeEvent;
|
|
|
|
PETHREAD CurrentScavengerThread;
|
|
|
|
PNET_ROOT CurrentNetRootForClosePendingProcessing;
|
|
|
|
PFCB CurrentFcbForClosePendingProcessing;
|
|
|
|
KEVENT ClosePendingProcessingSyncEvent;
|
|
|
|
} RDBSS_SCAVENGER, *PRDBSS_SCAVENGER;
|
|
|
|
|
|
|
|
#define RxInitializeRdbssScavenger(Scavenger, ScavengerTimeLimit) \
|
|
|
|
(Scavenger)->State = RDBSS_SCAVENGER_INACTIVE; \
|
|
|
|
(Scavenger)->SrvCallsToBeFinalized = 0; \
|
|
|
|
(Scavenger)->NetRootsToBeFinalized = 0; \
|
|
|
|
(Scavenger)->VNetRootsToBeFinalized = 0; \
|
|
|
|
(Scavenger)->FcbsToBeFinalized = 0; \
|
|
|
|
(Scavenger)->SrvOpensToBeFinalized = 0; \
|
|
|
|
(Scavenger)->FobxsToBeFinalized = 0; \
|
|
|
|
(Scavenger)->NumberOfDormantFiles = 0; \
|
|
|
|
(Scavenger)->MaximumNumberOfDormantFiles = 50; \
|
|
|
|
(Scavenger)->CurrentFcbForClosePendingProcessing = NULL; \
|
|
|
|
(Scavenger)->CurrentNetRootForClosePendingProcessing = NULL; \
|
|
|
|
if ((ScavengerTimeLimit).QuadPart == 0) \
|
|
|
|
{ \
|
|
|
|
(Scavenger)->TimeLimit.QuadPart = RX_SCAVENGER_FINALIZATION_TIME_INTERVAL; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
(Scavenger)->TimeLimit.QuadPart = (ScavengerTimeLimit).QuadPart; \
|
|
|
|
} \
|
|
|
|
KeInitializeEvent(&((Scavenger)->SyncEvent), NotificationEvent, FALSE); \
|
|
|
|
KeInitializeEvent(&((Scavenger)->ScavengeEvent), SynchronizationEvent, TRUE); \
|
|
|
|
KeInitializeEvent(&((Scavenger)->ClosePendingProcessingSyncEvent), NotificationEvent, FALSE); \
|
|
|
|
InitializeListHead(&(Scavenger)->SrvCallFinalizationList); \
|
|
|
|
InitializeListHead(&(Scavenger)->NetRootFinalizationList); \
|
|
|
|
InitializeListHead(&(Scavenger)->VNetRootFinalizationList); \
|
|
|
|
InitializeListHead(&(Scavenger)->SrvOpenFinalizationList); \
|
|
|
|
InitializeListHead(&(Scavenger)->FcbFinalizationList); \
|
|
|
|
InitializeListHead(&(Scavenger)->FobxFinalizationList); \
|
|
|
|
InitializeListHead(&(Scavenger)->ClosePendingFobxsList)
|
|
|
|
|
|
|
|
typedef struct _PURGE_SYNCHRONIZATION_CONTEXT
|
|
|
|
{
|
|
|
|
LIST_ENTRY ContextsAwaitingPurgeCompletion;
|
|
|
|
BOOLEAN PurgeInProgress;
|
|
|
|
} PURGE_SYNCHRONIZATION_CONTEXT, *PPURGE_SYNCHRONIZATION_CONTEXT;
|
|
|
|
|
|
|
|
VOID
|
|
|
|
RxInitializePurgeSyncronizationContext(
|
|
|
|
_In_ PPURGE_SYNCHRONIZATION_CONTEXT PurgeSyncronizationContext);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
RxScavengeRelatedFobxs(
|
|
|
|
_In_ PFCB Fcb);
|
|
|
|
|
[RDBSS]
- Implement __RxWriteReleaseResources(), RxCommonWrite(), RxCompleteMdl(), RxGetTopIrpIfRdbssIrp(), RxLowIoWriteShell(), RxLowIoWriteShellCompletion()
- Finish implementation of RxCommonCleanup() so that it handles setting EOF on a file
- Finish implementation of RxCommonCreate() so that it handles sharing violations and attempts to scavenge open files
[RXCE]
- Implement RxpScavengeFobxs(), RxpTrackDereference(), RxpTrackReference(), RxPurgeFobx(), RxPurgeRelatedFobxs(), RxReinitializeContext(), RxSetFileSizeWithLock(), RxScavengeFobxsForNetRoot()
- Fix a bug in RxPrefixTableLookupName() where it was badly handling nodes in scavenger
This commits brings several improvments to the NFS driver.
First of all, now, the driver handles creating, extending and writing to files!
It also handles purging dormant opened files when a file opening fails because of a sharing violation
Finally, it also brings something to look at our references issues in RDBSS to help finding out why our FCB are never (or nearly) dereferenced
CORE-8204
CORE-11327
CORE-13581
svn path=/trunk/; revision=75398
2017-07-24 17:05:05 +00:00
|
|
|
VOID
|
|
|
|
RxScavengeFobxsForNetRoot(
|
|
|
|
PNET_ROOT NetRoot,
|
|
|
|
PFCB PurgingFcb,
|
|
|
|
BOOLEAN SynchronizeWithScavenger);
|
|
|
|
|
[RDBSS]
- Implement RxCloseAssociatedSrvOpen(), RxFastIoRead(), RxPurgeNetFcb(), RxRemoveShareAccess(), RxRemoveShareAccessPerSrvOpens()
- Continue implementation of RxCommonCleanup() to handle allocated SRV_OPEN
- Halfplement RxFastIoCheckIfPossible() so that it handles read operations
- Stub RxCancelNotifyChangeDirectoryRequestsForFobx()
[RXCE]
- Implement RxChangeBufferingState(), RxFinalizeSrvOpen(), RxFreeFcbObject(), RxGatherRequestsForSrvOpen(), RxGetDeviceObjectOfInstance(), RxInitializeRxTimer(), RxMarkFobxOnCleanup(), RxMarkFobxOnClose(), RxpDiscardChangeBufferingStateRequests(), RxpDispatchChangeBufferingStateRequests(), RxpLookupSrvOpenForRequestLite(), RxpMarkInstanceForScavengedFinalization(), RxPostOneShotTimerRequest(), RxPrepareRequestForReuse(), RxProcessChangeBufferingStateRequestsForSrvOpen(), RxpUndoScavengerFinalizationMarking(), RxPurgeChangeBufferingStateRequestsForSrvOpen(), RxPurgeFobxFromCache(), RxRemoveNameNetFcb(), RxScavengerTimerRoutine(), RxTimerDispatch()
- Finish implementation of RxDereference() to handle scavenger
- Finish implementation of RxLowIoCompletionTail() to handle blocked operations resume
- Fix a bug in RxFinalizeNetFcb() where it was dereferencing its NET_ROOT instead of its V_NET_ROOT
- Fix bugs in __RxAcquireFcb() where it improperly handled the lack of RX_CONTEXT
- Halfplement RxResumeBlockedOperations_ALL() to extract blocked operations from RX_CONTEXT (and drop them...)
- Stub RxDispatchChangeBufferingStateRequests(), RxScavengerFinalizeEntries()
[COPYSUP]
- Implement FsRtlCopyRead2()
This library is basically what you can find in FsRtl with an extended support of Top Level IRP. It is used by RDBSS for FastIO. Next to come in it will be FsRtlCopyWrite2().
This commit brings several improvements to current work on RBDSS/RXCE. First of all, both libraries will leak less (again!).
It also brings the scavenger infrastructure (not fully fonctionnal though). Our NFS driver doesn't make use of it though.
Finally, this brings support of FastIO (for read operations ;-)) to our NFS driver!
Regarding CORE-13484, with copy + FastIO I could copy a file without troubles. But that seems to be still problematic with xcopy without FastIO...
CORE-13484
CORE-11327
svn path=/trunk/; revision=75265
2017-07-02 17:00:11 +00:00
|
|
|
VOID
|
|
|
|
RxpMarkInstanceForScavengedFinalization(
|
|
|
|
PVOID Instance);
|
|
|
|
|
[RDBSS]
[RXCE]
[DDK]
Add an initial implementation of the RXCE and RDBSS libraries that are used to implement mini-redirectors
The associated headers are also added to DDK
The implementation is partial (really!) and is only working for read-only operations.
It leaks memory as hell (no refcounting implemented) and thus, objects freeing is not implemented.
It was tested with NFS41 driver. With such RDBSS, it's possible for the driver to mount a remote share, to list
files, to query their properties, to query volume properties, and finally to read files (with some corruption under
specific conditions).
Please refrain from committing in this (especially for modifying whitespaces or fixing comments...), this is still WIP
and under development, it would mess with my local changes!
In itself, it doesn't bring anything to ReactOS yet, as no mini redirector is available in ReactOS source tree.
This may come later on with NFS41.
More to follow...
CORE-11327
svn path=/trunk/; revision=74674
2017-05-26 20:52:18 +00:00
|
|
|
VOID
|
|
|
|
RxpUndoScavengerFinalizationMarking(
|
|
|
|
_In_ PVOID Instance);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
RxScavengeVNetRoots(
|
|
|
|
_In_ PRDBSS_DEVICE_OBJECT RxDeviceObject);
|
|
|
|
|
|
|
|
#if (_WIN32_WINNT >= 0x0600)
|
|
|
|
VOID
|
|
|
|
RxSynchronizeWithScavenger(
|
|
|
|
_In_ PRX_CONTEXT RxContext,
|
|
|
|
_In_ PFCB Fcb);
|
|
|
|
#else
|
|
|
|
VOID
|
|
|
|
RxSynchronizeWithScavenger(
|
|
|
|
_In_ PRX_CONTEXT RxContext);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|