Hi,
I have lower disk filter driver, and witness a strange hang issue. From the
ful memory dump, I have found all Ios are queued in my driver, and cound not
be dispatched down. My driver has its owner StartIo (see the following
pseudo code).
The flag bStarted is set to TRUE in the dump, but I could not find any
thread executing MyDriverStartIo() code. Can the thread executing
MyDriverDispatchIo() by terminated by system or application? How can I do to
avoid the situation?
Thanks,
JT
MyDriverStartIo()
{
KeAcquireSpinLock(&startIoLock, oldIrp);
MyDriverQueueIo();
if(bStarted == TRUE)
{
KeReleaseSpinLock(&startIoLock, newIrp);
return;
}
bStarted = TRUE;
while(MyDriverQueueIsEmpty() != TRUE)
{
MyDriverDequeueIo();
KeReleaseSpinLock(&startIoLock, newIrp);
MyDriverDispatchIo();
KeAcquireSpinLock(&startIoLock, oldIrp);
}
bStarted = FALSE;
KeReleaseSpinLock(&startIoLock, newIrp);
return;
}
Is this code working? KeAcquireSpinLock takes a PKIRQL and
KeReleaseSpinLock takes KIRQL as second parameter.
-Srin.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jiangtao Zhou
Sent: Monday, March 15, 2004 7:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Hang in my driver
Hi,
I have lower disk filter driver, and witness a strange hang
issue. From the ful memory dump, I have found all Ios are
queued in my driver, and cound not be dispatched down. My
driver has its owner StartIo (see the following pseudo code).
The flag bStarted is set to TRUE in the dump, but I could not
find any thread executing MyDriverStartIo() code. Can the
thread executing
MyDriverDispatchIo() by terminated by system or application?
How can I do to avoid the situation?
Thanks,
JT
MyDriverStartIo()
{
KeAcquireSpinLock(&startIoLock, oldIrp);
MyDriverQueueIo();
if(bStarted == TRUE)
{
KeReleaseSpinLock(&startIoLock, newIrp);
return;
}
bStarted = TRUE;
while(MyDriverQueueIsEmpty() != TRUE)
{
MyDriverDequeueIo();
KeReleaseSpinLock(&startIoLock, newIrp);
MyDriverDispatchIo();
KeAcquireSpinLock(&startIoLock, oldIrp);
}
bStarted = FALSE;
KeReleaseSpinLock(&startIoLock, newIrp);
return;
}
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
Sorry for some typo. The pseudo code should be:
MyDriverStartIo()
{
KeAcquireSpinLock(&startIoLock, &oldIrp);
MyDriverQueueIo();
if(bStarted == TRUE)
{
KeReleaseSpinLock(&startIoLock, oldIrp);
return;
}
bStarted = TRUE;
while(MyDriverQueueIsEmpty() != TRUE)
{
MyDriverDequeueIo();
KeReleaseSpinLock(&startIoLock, oldIrp);
MyDriverDispatchIo();
KeAcquireSpinLock(&startIoLock, &oldIrp);
}
bStarted = FALSE;
KeReleaseSpinLock(&startIoLock, oldIrp);
return;
}
wrote in message news:xxxxx@ntdev…
Is this code working? KeAcquireSpinLock takes a PKIRQL and
KeReleaseSpinLock takes KIRQL as second parameter.
-Srin.
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Jiangtao Zhou
> Sent: Monday, March 15, 2004 7:48 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Hang in my driver
>
> Hi,
>
> I have lower disk filter driver, and witness a strange hang
> issue. From the ful memory dump, I have found all Ios are
> queued in my driver, and cound not be dispatched down. My
> driver has its owner StartIo (see the following pseudo code).
>
> The flag bStarted is set to TRUE in the dump, but I could not
> find any thread executing MyDriverStartIo() code. Can the
> thread executing
> MyDriverDispatchIo() by terminated by system or application?
> How can I do to avoid the situation?
>
> Thanks,
> JT
>
>
> MyDriverStartIo()
> {
>
> KeAcquireSpinLock(&startIoLock, oldIrp);
> MyDriverQueueIo();
> if(bStarted == TRUE)
> {
> KeReleaseSpinLock(&startIoLock, newIrp);
> return;
> }
>
> bStarted = TRUE;
>
> while(MyDriverQueueIsEmpty() != TRUE)
> {
> MyDriverDequeueIo();
>
> KeReleaseSpinLock(&startIoLock, newIrp);
>
> MyDriverDispatchIo();
>
> KeAcquireSpinLock(&startIoLock, oldIrp);
> }
>
> bStarted = FALSE;
>
> KeReleaseSpinLock(&startIoLock, newIrp);
>
> return;
> }
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@nai.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
Jiangtao Zhou wrote:
The flag bStarted is set to TRUE in the dump, but I could not find any
thread executing MyDriverStartIo() code. Can the thread executing
MyDriverDispatchIo() by terminated by system or application? How can I do to
avoid the situation?
I don’t think we have nearly enough information to diagnose your
problem. Clearly, there are cases where MyDriverStartIo() exits with
bStarted == TRUE (like, the first if).
If you’re asking whether or not there’s some weird edge-case where the
system will just stop a thread, the answer is “no”.
Looks like a bug you need to, ah, debug.
Peter
OSR
“PeterGV” wrote in message news:xxxxx@ntdev…
> Jiangtao Zhou wrote:
>
> >
> > The flag bStarted is set to TRUE in the dump, but I could not find any
> > thread executing MyDriverStartIo() code. Can the thread executing
> > MyDriverDispatchIo() by terminated by system or application? How can I
do to
> > avoid the situation?
> >
>
> I don’t think we have nearly enough information to diagnose your
> problem. Clearly, there are cases where MyDriverStartIo() exits with
> bStarted == TRUE (like, the first if).
It’s true MyDriverStartIo() can queue the Io and exit at the first if. It
indicates that another thread is calling to MyDriverStartIo() and doing the
Io dispatch, all previously queued Ios will be processed in this thread.
>
> If you’re asking whether or not there’s some weird edge-case where the
> system will just stop a thread, the answer is “no”.
>
> Looks like a bug you need to, ah, debug.
Actually this is a customer issue. it’s very hard for us to reproduce the
issue and debug it. This weird issue happens to one of our customers on two
w2k servers. The two w2k servers boot from the device our driver filters.
When the servers hang, we find some Ios queued for the boot devices in the
dump, and the bStarted is set to TRUE but we cannot find any thread is
executing MyDriverStartIo() to dispatch the Ios.
I have reviewed MyDriverStartIo code for many times and try to find any
logic error but I couldn’t.
>
> Peter
> OSR
>