Hi all,
currently I’m trying so solve a problem in our filterdriver. I already
posted this problem but I didn’t get any further. The sympthoms are as
follows:
When a large file is written through the “shadow device”, which is provided
by our filter driver, occationally the flush after the file is completely
written by BackupWrite() gets blocked. This suituation happens very rarely
with large files on W2k but on Win2003 it is easily reproudcible.
My interpretation is that the flush-thread currently waits exclusively on
resource 0x81edf258 and does not get it, since “mapped page writer” still
own it shared. It seems as the lazy writer and the explcit flush are
blocking erach other.
When looking at the PFN database, the file that is written shows the
following state:
Control Valid Standby Dirty Shared Locked PageTables name
8215f440 308 0 7040 0 1280 0 mapped_file( ~test.mpg.itr )
The control area looks as follows:
kd> !ca 8215f440
ControlArea @8215f440
Segment: e1874930 Flink 0 Blink 0
Section Ref 1 Pfn Ref 741 Mapped Views 2
User Ref 0 WaitForDel 0 Flush Count 0
File Object 81bd7e80 ModWriteCount 14 System Views 2
Flags (8080) File WasPurged
File: \large~test.mpg.itr
Segment @ e1874930:
Type MAPPED_FILE_SEGMENT not found.
I would suspect this this mapping is a result of the file system cache. I’ve
read the memory management section of Marc Russinovich’s “Inside Win 2000”
but I couldn’t find an explanation of pages that are in state “locked”. Are
these pages that are “currently” written to the file ?
As I stated ealier the filter attaches to NTFS drives only and does not use
AcquireForModWrite and ReleaseForModWrite handlers.
Thanks in advance for any help, comments or hints get a little further in
this problem.
Lars
kd> !locks -v 0x81edf258
Resource @ 0x81edf258 Shared 1 owning threads
Contention Count = 2
NumberOfSharedWaiters = 1
NumberOfExclusiveWaiters = 1
Threads: 822c3a58-93a1<*>
THREAD 822c3a58 Cid 0004.0078 Teb: 00000000 Win32Thread: 00000000
WAIT: (DelayExecution) KernelMode Non-Alertable
822c3ad0 NotificationTimer
Not impersonating
DeviceMap e10013b0
Owning Process 822af818
Wait Start TickCount 116984 Elapsed Ticks: 1
Context Switch Count 111131
UserTime 00:00:00.0000
KernelTime 00:00:01.0171
Start Address nt!MiMappedPageWriter (0x805071e3)
Stack Init f892f000 Current f892ecd4 Base f892f000 Limit f892c000 Call
0
Priority 17 BasePriority 8 PriorityDecrement 0
ChildEBP RetAddr
f892ecec 804e4252 nt!KiSwapContext+0x25 (FPO: [EBP 0xf892ed04] [0,0,4])
f892ed04 804e4692 nt!KiSwapThread+0x85
f892ed38 8051f78f nt!KeDelayExecutionThread+0x183
f892ed78 805072fa nt!MiWriteComplete+0x3c3
f892edac 805f1828 nt!MiMappedPageWriter+0x150
f892eddc 8050058e nt!PspSystemThreadStartup+0x2e
00000000 00000000 nt!KiThreadStartup+0x16
822ad020-01
THREAD 822ad020 Cid 0004.0024 Teb: 00000000 Win32Thread: 00000000
WAIT: (WrResource) KernelMode Non-Alertable
82115408 Semaphore Limit 0x7fffffff
822ad098 NotificationTimer
Not impersonating
DeviceMap e10013b0
Owning Process 822af818
Wait Start TickCount 116838 Elapsed Ticks: 147
Context Switch Count 1238
UserTime 00:00:00.0000
KernelTime 00:00:00.0000
Start Address nt!ExpWorkerThread (0x804ec50d)
Stack Init f88d7000 Current f88d6c30 Base f88d7000 Limit f88d4000 Call
0
Priority 13 BasePriority 13 PriorityDecrement 0
ChildEBP RetAddr
f88d6c48 804e4252 nt!KiSwapContext+0x25 (FPO: [EBP 0xf88d6c60] [0,0,4])
f88d6c60 804e42c2 nt!KiSwapThread+0x85
f88d6c90 805212c8 nt!KeWaitForSingleObject+0x209
f88d6ccc 8050388a nt!ExpWaitForResource+0xd1
f88d6ce0 f829acec nt!ExAcquireResourceSharedLite+0xaf
f88d6cec f82bf46b Ntfs!NtfsAcquirePagingResourceShared+0x1d (FPO:
[3,0,0])
f88d6d08 804f1014 Ntfs!NtfsAcquireScbForLazyWrite+0x78
f88d6d40 804ed5e2 nt!CcWriteBehind+0x22
f88d6d80 804ec5c8 nt!CcWorkerThread+0x123
f88d6dac 805f1828 nt!ExpWorkerThread+0xe9
f88d6ddc 8050058e nt!PspSystemThreadStartup+0x2e
00000000 00000000 nt!KiThreadStartup+0x16
Threads Waiting On Exclusive Access:
81f65da0
kd> !thread 81f65da0
THREAD 81f65da0 Cid 0170.00c8 Teb: 7ffde000 Win32Thread: e184a008 WAIT:
(WrResource) KernelMode Non-Alertable
8218a6a8 SynchronizationEvent
81f65e18 NotificationTimer
Not impersonating
DeviceMap e164e0d0
Owning Process 81f53c00
Wait Start TickCount 116784 Elapsed Ticks: 201
Context Switch Count 558932 LargeStack
UserTime 00:00:03.0250
KernelTime 00:00:24.0046
Start Address 0x77e2f35f
Win32 Start Address 0x00405f10
Stack Init f5f05000 Current f5f04950 Base f5f05000 Limit f5f01000 Call 0
Priority 10 BasePriority 8 PriorityDecrement 2
*** ERROR: Module load completed but symbols could not be loaded for
IvdIFS_G.sys
ChildEBP RetAddr Args to Child
f5f04968 804e4252 81f65da0 8218a6a8 00000000 nt!KiSwapContext+0x25 (FPO:
[EBP 0xf5f04980] [0,0,4])
f5f04980 804e42c2 81f65da0 81edf258 00000000 nt!KiSwapThread+0x85
f5f049b0 805212c8 8218a6a8 0000001b 00000000 nt!KeWaitForSingleObject+0x209
f5f049ec 804ef26b e1947678 82121a38 f5f04a74 nt!ExpWaitForResource+0xd1
f5f049fc f829acb8 81edf258 00000001 f82ca671
nt!ExAcquireResourceExclusiveLite+0x6c
f5f04a08 f82ca671 82121a38 e1947678 00000001
Ntfs!NtfsAcquirePagingResourceExclusive+0x1d (FPO: [3,0,0])
f5f04a74 f82ca8ff 82121a38 82153970 82153970
Ntfs!NtfsCommonFlushBuffers+0x10d
f5f04ad8 804e0e0d 82102598 82153970 81e732c0 Ntfs!NtfsFsdFlushBuffers+0x92
f5f04ae8 f610b8df 82153970 81e732c0 804efd6b nt!IofCallDriver+0x3f (FPO:
[0,0,0])
WARNING: Stack unwind information not available. Following frames may be
wrong.
f5f04ca8 f6106885 82167588 82153970 00000000 IvdIFS_G+0x68df
f5f04cbc 804e0e0d 82167588 82153970 82153970 IvdIFS_G+0x1885
f5f04ccc 805759ea 81bd7e80 82153970 00000000 nt!IofCallDriver+0x3f (FPO:
[0,0,0])
f5f04ce0 805921b0 82167588 82153970 81bd7e80
nt!IopSynchronousServiceTail+0x6c
f5f04d54 804e7a8c 0000071c 0011cda4 00000000 nt!NtFlushBuffersFile+0x1b5
f5f04d54 7ffe0304 0000071c 0011cda4 00000000 nt!KiSystemService+0xcb (FPO:
[0,0] TrapFrame @ f5f04d64)
0011cdac 00000000 00000000 00000000 00000000
SharedUserData!SystemCallStub+0x4 (FPO: [0,0,0])