23#define BugCheckFileId (FAT_BUG_CHECK_CLOSE)
29#define Dbg (DEBUG_TRACE_CLOSE)
34#define FatAcquireCloseMutex() { \
35 NT_ASSERT(KeAreApcsDisabled()); \
36 ExAcquireFastMutexUnsafe( &FatCloseQueueMutex ); \
39#define FatReleaseCloseMutex() { \
40 NT_ASSERT(KeAreApcsDisabled()); \
41 ExReleaseFastMutexUnsafe( &FatCloseQueueMutex ); \
72#pragma alloc_text(PAGE, FatFsdClose)
73#pragma alloc_text(PAGE, FatFspClose)
74#pragma alloc_text(PAGE, FatRemoveClose)
75#pragma alloc_text(PAGE, FatCommonClose)
76#pragma alloc_text(PAGE, FatCloseWorker)
179#if (NTDDI_VERSION >= NTDDI_WIN8)
240 if( CloseContext ==
NULL ) {
249 CloseContext = &
Ccb->CloseContext;
271 FatQueueClose( CloseContext,
286 if (CloseContext !=
NULL) {
388 ULONG LoopsWithVcbHeld = 0;
404 while ((CloseContext = FatRemoveClose(
Vcb, LastVcb)) !=
NULL) {
419 if (CloseContext->
Vcb != CurrentVcb) {
421 LoopsWithVcbHeld = 0;
427 if (CurrentVcb !=
NULL) {
436 CurrentVcb = CloseContext->
Vcb;
446 if (++LoopsWithVcbHeld >= 20) {
455 LoopsWithVcbHeld = 0;
479 }
else if (CurrentVcb !=
NULL) {
486 LastVcb = CurrentVcb;
500 FreeContext = CloseContext->
Free;
502 (
VOID)FatCommonClose( CloseContext->
Vcb,
504 (FreeContext ?
NULL :
534 if (CurrentVcb !=
NULL) {
590 &CloseContext->GlobalLinks );
592 &CloseContext->VcbLinks );
606 &CloseContext->GlobalLinks );
608 &CloseContext->VcbLinks );
812 }
else if (LastVcbHint) {
890 LocalVcbDeleted =
FALSE;
894 *VcbDeleted = LocalVcbDeleted;
918 IrpContext.NodeByteSize =
sizeof( IrpContext );
920 IrpContext.Vcb =
Vcb;
933#pragma prefast( suppress: 28137, "prefast wants Wait to be a constant, but that's not possible for fastfat" )
961 RecursiveClose =
TRUE;
967 RecursiveClose =
FALSE;
975 Vcb->OpenFileCount += 1;
1004 Vcb->DirectAccessOpenCount -= 1;
1005 Vcb->OpenFileCount -= 1;
1053 if ( RecursiveClose ) {
1066 DebugTrace(0,
Dbg,
"Close UserFileOpen/UserDirectoryOpen\n", 0);
1079 DebugTrace(0,
Dbg,
"Uninitialize the stream file object\n", 0);
1094 Vcb->OpenFileCount -= 1;
1104#pragma prefast( suppress: 28159, "if the type of open is unknown, we seriously messed up." )
1145 DirectoryFileObject =
ParentDcb->Specific.Dcb.DirectoryFile;
1147 DebugTrace(0,
Dbg,
"Uninitialize our parent Stream Cache Map\n", 0);
1162 if (
ParentDcb->Specific.Dcb.DirectoryFileOpenCount == 0) {
1193 if (!RecursiveClose) {
1204 if (
Vcb->OpenFileCount == 1 &&
1224#pragma prefast( suppress: 28137, "prefast wants the wait parameter in this macro expansion to be a constant, unfortunately this is not possible" )
1239 Vcb->OpenFileCount -= 1;
1241 LocalVcbDeleted = FatCheckForDismount( &IrpContext,
1253 *VcbDeleted = LocalVcbDeleted;
1262 Vcb->OpenFileCount -= 1;
1269 if (!LocalVcbDeleted) {
1279 if (!LocalVcbDeleted) {
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedDecrement
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define IRP_CONTEXT_FLAG_WAIT
#define _Requires_lock_held_(lock)
ULONG FatMaxDelayedCloseCount
#define FatReleaseCloseMutex()
#define FatAcquireCloseMutex()
VOID NTAPI FatCloseWorker(_In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PVOID Context)
_In_ PIO_STACK_LOCATION IrpSp
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB ParentDcb
#define FatBugCheck(A, B, C)
#define FAT_NTC_IRP_CONTEXT
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define ExAcquireResourceExclusiveLite(res, wait)
#define RemoveHeadList(ListHead)
#define ClearFlag(_F, _SF)
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
#define DebugTrace(INDENT, LEVEL, X, Y)
VOID FatDeleteFcb(IN PIRP_CONTEXT IrpContext, IN PFCB *Fcb)
VOID FatDeleteCcb(IN PIRP_CONTEXT IrpContext, IN PCCB *Ccb)
#define FatAcquireExclusiveGlobal(IRPCONTEXT)
#define IsFileObjectReadOnly(FO)
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
#define FatReleaseGlobal(IRPCONTEXT)
#define FatDeviceIsFatFsdo(D)
#define FatAcquireExclusiveVcb(IC, V)
VOID FatDeallocateCcbStrings(IN PCCB Ccb)
#define FatGetFcbOplock(F)
#define FatIsFileOplockable(F)
#define FatReleaseVcb(IRPCONTEXT, Vcb)
PCLOSE_CONTEXT FatAllocateCloseContext(IN PVCB Vcb)
#define VCB_STATE_FLAG_DELETED_FCB
#define CCB_FLAG_READ_ONLY
#define VCB_STATE_FLAG_CREATE_IN_PROGRESS
#define VCB_STATE_FLAG_DISMOUNT_IN_PROGRESS
#define CCB_FLAG_CLOSE_CONTEXT
#define VCB_STATE_FLAG_CLOSE_IN_PROGRESS
#define FCB_STATE_DELAY_CLOSE
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define FSRTL_FSP_TOP_LEVEL_IRP
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
static DWORD CALLBACK WorkerThread(LPVOID Parameter)
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define _Function_class_(n)
#define UNREFERENCED_PARAMETER(P)
#define ARGUMENT_PRESENT(ArgumentPointer)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
ULONG NTAPI ExGetSharedWaiterCount(IN PERESOURCE Resource)
ULONG NTAPI ExGetExclusiveWaiterCount(IN PERESOURCE Resource)
#define IoCompleteRequest
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
PULONG MinorVersion OPTIONAL
enum _TYPE_OF_OPEN TypeOfOpen
base of all file and directory entries
LIST_ENTRY AsyncCloseList
PIO_WORKITEM FatCloseItem
LIST_ENTRY DelayedCloseList
union _FCB::@730 Specific
struct _FCB::@730::@732 Dcb
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_ WDFDPC _In_ BOOLEAN Wait
#define FO_CLEANUP_COMPLETE
#define IO_DISK_INCREMENT
#define ObDereferenceObject
#define PsGetCurrentProcess