Scanner sample in DDK hangs for 30-40 seconds in FltReadFile call

Hello,

I am experimenting with the scanner sample in the DDK and here is an issue that I observe

  1. I compiled the scanner sample out-of-box and installed it on a Windows 2008 R2 file server.
  2. scanner.sys is running on Windows 2008 R2 file server “server” which hosts a share “share”.
  3. I copy a small 12K file from a Windows 7 network client (that is not running scanner.sys) to \server\share using command shell (cmd.exe).
  4. The copy operation goes in hung state and completes after 30-35 seconds. NOTE: There are no issues with my network. The copy operation finish immediately if scanner sample is not running.

If I run “!stacks 2 scanner” from the debugger while it’s in hung state, I see it being blocked in FltReadFile call. It’s not a deadlock and FltReadFile successfully returns in 30-35 seconds

4.000498 fffffa8004c959c0 fffe2c1e Blocked nt!KiSwapContext+0x7a
nt!KiCommitThreadWait+0x1d2
nt!KeWaitForSingleObject+0x19f
nt!FsRtlCancellableWaitForMultipleObjects+0x5e
nt!FsRtlCancellableWaitForSingleObject+0x27
fltmgr! ?? ::FNODOBFM::`string’+0x2b39
fltmgr!FltPerformSynchronousIo+0x2ca
fltmgr!FltReadFile+0x334
scanner+0x1593
scanner+0x10c4
fltmgr!FltpPerformPostCallbacks+0x368
fltmgr!FltpLegacyProcessingAfterPreCallbacksCompleted+0x39b
fltmgr!FltpCreate+0x2a9
nt!IopParseDevice+0x5a5
nt!ObpLookupObjectName+0x312
nt!ObOpenObjectByName+0x306
nt!IopCreateFile+0x2bc
nt!IoCreateFileEx+0xfb
srv2!SrvCreateFile+0x316
srv2!Smb2ExecuteCreateReal+0x1c4
srv2!Smb2ExecuteProviderCallback+0x97
srv2!SrvProcessPacket+0xa0
srv2!SrvProcWorkerThread+0x15a
nt!PspSystemThreadStartup+0x5a
nt!KiStartSystemThread+0x16

I do not see this issue if I am copying the file locally on the file server.
If I unload scanner.sys, the issue goes away.

Any idea what may be going wrong here?

Thanks.
-Prasad