IoAcquireVpbSpinLock function (ntifs.h)

The IoAcquireVpbSpinLock routine acquires the Volume Parameter Block (VPB) spin lock.

Syntax

void IoAcquireVpbSpinLock(
  [out] PKIRQL Irql
);

Parameters

[out] Irql

Pointer to a caller-allocated variable in which to save the current IRQL for a subsequent call to IoReleaseVpbSpinLock. Usually the Irql is saved on the stack as a local variable.

Return value

None

Remarks

File systems call IoAcquireVpbSpinLock to acquire the VPB spin lock. This global spin lock must be acquired before accessing any of the following fields of a VPB:

  • Flags (specifically, VPB_MOUNTED)

  • DeviceObject

  • RealDevice

  • ReferenceCount

Every successful call to IoAcquireVpbSpinLock must be matched by a subsequent call to IoReleaseVpbSpinLock. To prevent deadlock, the holder of the VPB spin lock must release it immediately when it is no longer needed.

Before using IoAcquireVpbSpinLock and IoReleaseVpbSpinLock, driver writers are strongly encouraged to study the way these routines are used in the FASTFAT sample.

After calling IoAcquireVpbSpinLock, the caller executes at IRQL DISPATCH_LEVEL. Calling IoReleaseVpbSpinLock restores the caller's original IRQL.

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport)

See also

IoReleaseVpbSpinLock