vista sp1 RDR bug(rdbss!RxIterateOnFcbOpens)?Microsoft please explain it.
I developped a very simple minifilter for test!It is base on the sample:swapbuffers.
In PostCreate on RDR,I just call FltCreateFile to open the original file.And then I call FltClose
to close it.
It's very simple!It works well in win2K,winxp,win2K3,and vista sp0.
But in vista SP1,it works very slowly calling FltClose!
When calling FltClose in my minifilter PostCreate,I break the WinDbg and trace the stacks:
nt!KiSwapContext+0x26
nt!KiSwapThread+0x44f
nt!KeDelayExecutionThread+0x472
rdbss!RxCommonCleanup+0x680
rdbss!RxFsdCommonDispatch+0x59c
rdbss!RxFsdDispatch+0x19f
mrxsmb!MRxSmbFsdDispatch+0x99
nt!IofCallDriver+0x63
mup!MupiCallUncProvider+0x10d
mup!MupStateMachine+0x9b
mup!MupCleanup+0x91
nt!IofCallDriver+0x63
fltmgr!FltpLegacyProcessingAfterPreCallbacksCompleted+0x251
fltmgr!FltpDispatch+0xc2
nt!IofCallDriver+0x63
nt!IopCloseFile+0x387
nt!ObpDecrementHandleCount+0x146
nt!ObpCloseHandleTableEntry+0x234
nt!ObpCloseHandle+0x73
nt!NtClose+0x20
nt!KiFastCallEntry+0x12a
nt!ZwClose+0x11
SwapBuffers!SwapPostCreate+0xc6 [d:\work2\2008.5.1\swapbuffers\swapbuffers.c @ 1107]
fltmgr!FltpPerformPostCallbacks+0x1f1
fltmgr!FltpProcessIoCompletion+0x10
fltmgr!FltpPassThroughCompletion+0x94
fltmgr!FltpLegacyProcessingAfterPreCallbacksCompleted+0x2e1
nt!IofCallDriver+0x63
nt!IopParseDevice+0xf61
nt!ObpLookupObjectName+0x5a8
nt!ObOpenObjectByName+0x13c
nt!IopCreateFile+0x63b
nt!NtCreateFile+0x34
nt!KiFastCallEntry+0x12a
ntdll!KiFastSystemCallRet
I analyzed the disassemble code in rdbss!RxCommonCleanup.
In this case(my Minifilter call FltClose very slowly),
rdbss!RxCommonCleanup will call rdbss!RxIterateOnFcbOpens.
After rdbss!RxIterateOnFcbOpens returned,it will test some condition,
result to call KeDelayExecutionThread(-280ms).
After the KeDelayExecutionThread(-280ms) expired,it will inc the loop counter,and do it again.
the loop counter's limit is 0x1e.
When the loop counter reached 0x1e,it will exit the case.
So,in my simple minifilter,calling FltClose will comsume 8 seconds.
In other case(the app call CreateFile and CloseHandle for a RDR file),
rdbss!RxCommonCleanup will not trap in the loop(will not call rdbss!RxIterateOnFcbOpens).
oh,anybody can explain it?What is it waiting for?Maybe we need MicroSoft team,haha.
Why I need call FltCreate and FltClose in PostCreate on RDR?
When I am interesting in the opened RDR file in PostCreate,I need issued a Oplock Break to it.
So,I call FltCreate to open the file,and issued my IRP to take a byte range lock,and call
FltClose.
Is there any idea for taking Oplock Break to the opened RDR file?