NTFS Locking

A file open request gets stuck when trying to open a file in a user-mode
callback function from a pre-cleanup kernel routine. It seems that NTFS is
indefinitely waiting for a mutex object(KeWaitForMutexObject) , but why
cannot i open the same file again from user-mode?. And please , if possible
provide hints to work around it.
The testing has been carried out on a Windows XP SP2 and below is the stack
trace and other related information.

Thanks in advance.

Extended Thread Info for thread 628

Active IRP Queue:
IRP (8122BE48)

Thread Wait List:
Event Object at FBD058E0

Registers: ESI=FFDFF120 EDI=810C8820 EBX=FBD058E0 EBP=FBD05894
Restart : EIP=804DBDE0 a.k.a. ntoskrnl!ExReleaseResourceLite+0210

Warning: Symbols for NTOSKRNL are not loaded. Call stack may be inaccurate.
FrameEBP RetEIP Syms Symbol
FBD05894 FC336956 N ntoskrnl!ExReleaseResourceLite+0210
FBD05978 804E3D77 N Ntfs!PAGE+00023356
FBD05A0C FC3F2EA0 N ntoskrnl!IofCallDriver+0032
FBD05A4C 804E3D77 N fltmgr!PAGE+00017EA0
FBD05B3C 8056386C N ntoskrnl!IofCallDriver+0032
FBD05BC4 80567C63 N ntoskrnl!RtlEqualUnicodeString+04CF
FBD05C18 80571477 N ntoskrnl!ObOpenObjectByName+00DB
FBD05C94 80571546 N ntoskrnl!FsRtlCurrentBatchOplock+0212
FBD05CF0 8057167C N ntoskrnl!IoCreateFile+004F
FBD05D30 804DF06B N ntoskrnl!NtCreateFile+0030
00A0F19C 7C801A4F N ntdll!.text+DB94
00A0F1C0 004227F0 N KERNEL32!CreateFileA+002B
00A0F22C 0041B82A Y Test!_sopen+02E0
00A0F268 004158BF Y Test!_openfile+02AA
00A0F288 00415922 Y Test!_fsopen+00CF
00A0F29C 00411B9C Y Test!fopen+0012

:irp 8122be48
MdlAddress * : 00000000
Flags : 00000884 IRP_SYNCHRONOUS_API | IRP_CREATE_OPERATION |
IRP_DEFER_IO_COMPLETION
AssociatedIrp : 00000000
&ThreadListEntry : 8122BE58
IoStatus.Status : 00000000
IoStatus.Information : E157D6D0
RequestorMode : 01
PendingReturned : False
StackCount : 09
CurrentLocation : 07
Cancel : False
CancelIrql : 00
ApcEnvironment : 00
UserIosb * : FBD05AF4
UserEvent * : 00000000
Overlay : 00000000 00000000
CancelRoutine * : 8052CA0D
UserBuffer * : 00000000
Tail.Overlay
&DeviceQueueEntry : 8122BE88
Thread * : 810C8820
AuxiliaryBuffer * : 00000000
&ListEntry : 8122BEA0
CurrentStackLoc * : 8122BF90
OrigFileObject * : FFB8DEC0
Tail.Apc * : 8122BE88
Tail.ComplKey : 00000000

CurrentStackLocation at 8122BF90:
MajorFunction : 00 IRP_MJ_CREATE
MinorFunction : 00
Control : E1
Flags : 00
SecurityContext * : FBD05A88
Options : 01000060
FileAttributes : 00000080
ShareAccess : 00000003
EaLength : 00000000
DeviceObject * : 8129E020
FileObject * : FFB8DEC0
CompletionRout * : FC336992
Context * : FBD058DC
:fobj ffb8dec0
DeviceObject * : 812A32B8
Vpb * : 00000000
FsContext * : 00000000
FsContext2 * : 00000000
SecObjPointer * : 00000000
PrivateCacheMap * : 00000000
FinalStatus : 00000000
RelatedFileObj * : 00000000
LockOperation : False
DeletePending : False
ReadAccess : False
WriteAccess : False
DeleteAccess : False
SharedRead : False
SharedWrite : False
SharedDelete : False
Flags : 00000002 FO_SYNCHRONOUS_IO
FileName : \Util\test.txt
CurrentByteOffset : 00
Waiters : 00000000
Busy : 00000000
LastLock* : 00000000
&Lock : FFB8DF0C
&Event : FFB8DF1C
ComplContext* : 00000000


Want to block unwanted pop-ups? Download the free MSN Toolbar now!
http://toolbar.msn.co.uk/