NTFS deadlock when refreshing volume stack

Hi,
My driver is an upper filter driver for volumes.
To install it, I use the appropriate setupDi function to refresh all volume device stacks.
During QA stress tests, when all the volumes underwent big file-system I/O stress(All NTFS), one of the refresh called was stuck and the installer appeared to hang.
Using WINDBG I saw the some interesting stacks:
4.000010 81fcd020 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
Ntfs!NtfsCheckpointVolume+0xcc
Ntfs!NtfsCheckpointForLogFileFull+0x30
Ntfs!NtfsFsdSetInformation+0x8a
nt!IopfCallDriver+0x31
sr!SrSetInformation+0x177
nt!IopfCallDriver+0x31
nt!CcSetValidData+0xa6
nt!CcWriteBehind+0x206
nt!CcWorkerThread+0x116
nt!ExpWorkerThread+0xfe
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000014 81fcdda8 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeRemoveQueue+0x20c
nt!ExpWorkerThread+0xd4
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000018 81fcdb30 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
Ntfs!NtfsCheckpointVolume+0xcc
Ntfs!NtfsCheckpointForLogFileFull+0x30
Ntfs!NtfsFsdSetInformation+0x8a
nt!IopfCallDriver+0x31
sr!SrSetInformation+0x177
nt!IopfCallDriver+0x31
nt!CcSetValidData+0xa6
nt!CcWriteBehind+0x206
nt!CcWorkerThread+0x116
nt!ExpWorkerThread+0xfe
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.00001c 81fcd8b8 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeRemoveQueue+0x20c
nt!ExpWorkerThread+0xd4
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000020 81fcd640 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
Ntfs!NtfsCheckpointVolume+0xcc
Ntfs!NtfsCheckpointForLogFileFull+0x30
Ntfs!NtfsFsdSetInformation+0x8a
nt!IopfCallDriver+0x31
sr!SrSetInformation+0x177
nt!IopfCallDriver+0x31
nt!CcSetValidData+0xa6
nt!CcWriteBehind+0x206
nt!CcWorkerThread+0x116
nt!ExpWorkerThread+0xfe
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000024 81fcd3c8 Blocked Stack paged out
4.000028 81fcc020 Blocked Stack paged out
4.00002c 81fccda8 Blocked Stack paged out
4.000030 81fccb30 Blocked Stack paged out
4.000034 81fcc8b8 Blocked Stack paged out
4.000038 81fcc640 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
nt!CcWaitForCurrentLazyWriterActivity+0xca
Ntfs!NtfsCommonPnp+0x10d
Ntfs!NtfsFsdPnp+0xa8
nt!IopfCallDriver+0x31
sr!SrPnp+0x90
nt!IopfCallDriver+0x31
nt!IopSynchronousCall+0xb8
nt!IopRemoveDevice+0x89
nt!IopQueryRemoveLockedDeviceNode+0x2f
nt!IopDeleteLockedDeviceNode+0x4c
nt!IopDeleteLockedDeviceNodes+0x3d
nt!PiProcessQueryRemoveAndEject+0x58c
nt!PiProcessTargetDeviceEvent+0x24
nt!PiWalkDeviceList+0xce
It seems that NtfsCommonPnp waits for some I/O to completes but the I/O never finishes.
The machine is win XP UP (Service Pack 1).
Can anyone please shed some light on this.
Regards.
ERAN


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Offhand I’d say you have a classic PnP deadlock, one of the symptoms of
which will in fact be an NTFS hang as it gets wrapped up in the same
deadlock for various reasons. !pnpevent in windbg is your friend here. Use
pnpevent to dump the pnp event queue. Use dd on the address of the event
queue and look at the 8th dword displayed. If this is a non-zero value it is
the thread that is currently the most likely culprit as the cause of the
deadlock. If it is zero then there is some other cause.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of eran borovik
Sent: Tuesday, August 03, 2004 2:27 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] NTFS deadlock when refreshing volume stack

Hi,
My driver is an upper filter driver for volumes.
To install it, I use the appropriate setupDi function to refresh all
volume device stacks.
During QA stress tests, when all the volumes underwent big
file-system I/O stress(All NTFS), one of the refresh called was stuck and
the installer appeared to hang.
Using WINDBG I saw the some interesting stacks:
4.000010 81fcd020 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
Ntfs!NtfsCheckpointVolume+0xcc

Ntfs!NtfsCheckpointForLogFileFull+0x30
Ntfs!NtfsFsdSetInformation+0x8a
nt!IopfCallDriver+0x31
sr!SrSetInformation+0x177
nt!IopfCallDriver+0x31
nt!CcSetValidData+0xa6
nt!CcWriteBehind+0x206
nt!CcWorkerThread+0x116
nt!ExpWorkerThread+0xfe
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000014 81fcdda8 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeRemoveQueue+0x20c
nt!ExpWorkerThread+0xd4
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000018 81fcdb30 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
Ntfs!NtfsCheckpointVolume+0xcc

Ntfs!NtfsCheckpointForLogFileFull+0x30
Ntfs!NtfsFsdSetInformation+0x8a
nt!IopfCallDriver+0x31
sr!SrSetInformation+0x177
nt!IopfCallDriver+0x31
nt!CcSetValidData+0xa6
nt!CcWriteBehind+0x206
nt!CcWorkerThread+0x116
nt!ExpWorkerThread+0xfe
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.00001c 81fcd8b8 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeRemoveQueue+0x20c
nt!ExpWorkerThread+0xd4
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000020 81fcd640 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0
Ntfs!NtfsCheckpointVolume+0xcc

Ntfs!NtfsCheckpointForLogFileFull+0x30
Ntfs!NtfsFsdSetInformation+0x8a
nt!IopfCallDriver+0x31
sr!SrSetInformation+0x177
nt!IopfCallDriver+0x31
nt!CcSetValidData+0xa6
nt!CcWriteBehind+0x206
nt!CcWorkerThread+0x116
nt!ExpWorkerThread+0xfe
nt!PspSystemThreadStartup+0x34
nt!KiThreadStartup+0x16
4.000024 81fcd3c8 Blocked Stack paged out
4.000028 81fcc020 Blocked Stack paged out
4.00002c 81fccda8 Blocked Stack paged out
4.000030 81fccb30 Blocked Stack paged out
4.000034 81fcc8b8 Blocked Stack paged out
4.000038 81fcc640 Blocked nt!KiSwapContext+0x2e
nt!KiSwapThread+0x44
nt!KeWaitForSingleObject+0x1c0

nt!CcWaitForCurrentLazyWriterActivity+0xca
Ntfs!NtfsCommonPnp+0x10d
Ntfs!NtfsFsdPnp+0xa8
nt!IopfCallDriver+0x31
sr!SrPnp+0x90
nt!IopfCallDriver+0x31
nt!IopSynchronousCall+0xb8
nt!IopRemoveDevice+0x89

nt!IopQueryRemoveLockedDeviceNode+0x2f
nt!IopDeleteLockedDeviceNode+0x4c
nt!IopDeleteLockedDeviceNodes+0x3d

nt!PiProcessQueryRemoveAndEject+0x58c
nt!PiProcessTargetDeviceEvent+0x24
nt!PiWalkDeviceList+0xce
It seems that NtfsCommonPnp waits for some I/O to completes but the
I/O never finishes.
The machine is win XP UP (Service Pack 1).
Can anyone please shed some light on this.
Regards.
ERAN


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the Kernel Driver
FAQ at http://www.osronline.com/article.cfm?id=256 You are currently
subscribed to ntdev as: xxxxx@hollistech.com To unsubscribe send a blank
email to xxxxx@lists.osr.com