FsRtlExitFileSystem function

The FsRtlExitFileSystem macro re-enables the delivery of normal kernel-mode APCs that a preceding call to FsRtlEnterFileSystem disabled.

Syntax

VOID FsRtlExitFileSystem(
   VOID 
);

Parameters

None

Return value

This function doesn't return a value.

Remarks

Every file system driver entry point routine must call FsRtlEnterFileSystem immediately before acquiring a resource required in performing a file I/O request and call FsRtlExitFileSystem immediately afterward. This ensures that the routine can't be suspended while running and thus block other file I/O requests.

Every successful call to FsRtlEnterFileSystem must be matched by a subsequent call to FsRtlExitFileSystem.

Unlike local file systems and network redirectors, file system filter drivers should never disable delivery of normal kernel APCs (by calling FsRtlEnterFileSystem or KeEnterCriticalRegion or by raising to IRQL APC_LEVEL) across a call to IoCallDriver.

The only time when a file system filter driver should disable normal kernel APCs is immediately before calling ExAcquireResourceExclusive, ExAcquireResourceExclusiveLite, ExAcquireResourceShared, ExAcquireResourceSharedLite, or ExAcquireSharedStarveExclusive. After the filter driver calls ExReleaseResource or ExReleaseResourceLite, it should immediately re-enable delivery of normal kernel APCs. As an alternative to FsRtlEnterFileSystem, minifilter drivers can use the FltAcquireResourceExclusive, FltAcquireResourceShared, and FltReleaseResource routines, which properly handle APCs when acquiring and releasing a resource.

It isn't necessary to disable normal kernel APCs before calling ExAcquireSharedWaitForExclusive because this routine calls KeRaiseIrqlToDpcLevel, which disables both normal and special kernel APCs. It's also not necessary to do so before calling ExAcquireFastMutex or ExAcquireResourceExclusive, because these routines disable normal kernel APCs.

Requirements

Requirement type Requirement
Header Ntifs.h (include Ntifs.h)
IRQL <= APC_LEVEL

See also

ExAcquireFastMutex

ExAcquireResourceExclusive

ExAcquireResourceExclusiveLite

ExAcquireResourceShared

ExAcquireResourceSharedLite

ExAcquireSharedWaitForExclusive

ExAcquireSharedStarveExclusive

ExReleaseResource

ExReleaseResourceLite

ExTryToAcquireFastMutex

FltAcquireResourceExclusive

FltAcquireResourceShared

FltReleaseResource

FsRtlEnterFileSystem

IoCallDriver

KeLeaveCriticalRegion

KeRaiseIrqlToDpcLevel