disk I/O request never completed - why?

I’m doing a series of read requests to a USB mass storage driver using
the following sequence of calls (some editing) :

{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK Iosb;

KeInitializeEvent( &Event, NotificationEvent, FALSE );

Irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE,
TargetDeviceObject,
Buffer,
NumberOfBytesToRead,
&ByteOffset,
&Event,
&Iosb );

if ( Irp == NULL )
return( STATUS_INSUFFICIENT_RESOURCES ) ;

Status = IoCallDriver( TargetDeviceObject, Irp );

if (Status == STATUS_PENDING) {
KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE,
(PLARGE_INTEGER)NULL );
Status = Iosb.Status;
}

This seems to work for a number of calls. Sometimes IoCallDriver
returns the STATUS_PENDING value but after the event is signaled, the
status value in the
status block indicates success.

However, after one STATUS_PENDING return, the event is never signaled.
The problem occurs at the same read on every run. My code looks
equivalent to a number of samples from the W2000 DDK. I tried replacing

the standard W2000 usbstor.sys driver with one specific to the H/W
device. The no-signal problem is not affected by the driver change.

Has anyone seen a problem like this before? Any suggestions for
possible causes? Or lines of investigation?

Bill Hunt

Use IoBuildSynchronousFsdRequest only if the caller is running in a nonarbitrary thread context and at IRQL PASSIVE_LEVEL.

If the current IRQL > IRQL_PASSIVE_LEVEL, you can use next iostack of the irp or make
ssociated irps for the master irp and dispatch to the USB storage driver.

========================
Matt Wu
E-Mail: mattwu@163.com
WebSite:http://sys.xiloo.com

I’m doing a series of read requests to a USB mass storage driver using
the following sequence of calls (some editing) :

{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK Iosb;

KeInitializeEvent( &Event, NotificationEvent, FALSE );

Irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE,
TargetDeviceObject,
Buffer,
NumberOfBytesToRead,
&ByteOffset,
&Event,
&Iosb );

if ( Irp == NULL )
return( STATUS_INSUFFICIENT_RESOURCES ) ;

Status = IoCallDriver( TargetDeviceObject, Irp );

if (Status == STATUS_PENDING) {
KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE,
(PLARGE_INTEGER)NULL );
Status = Iosb.Status;
}

This seems to work for a number of calls. Sometimes IoCallDriver
returns the STATUS_PENDING value but after the event is signaled, the
status value in the
status block indicates success.

However, after one STATUS_PENDING return, the event is never signaled.
The problem occurs at the same read on every run. My code looks
equivalent to a number of samples from the W2000 DDK. I tried replacing

the standard W2000 usbstor.sys driver with one specific to the H/W
device. The no-signal problem is not affected by the driver change.

Has anyone seen a problem like this before? Any suggestions for
possible causes? Or lines of investigation?

Bill Hunt

Bill,
Check the IRQ Level at which your read is failing. Is it a Cache Manager initiated request. That would be at APC level and IRPs built with IoBuildSynchronousFsdRequest would fail. (Consult the DDK documentation.)
At high IRQ levels, hand create your own IRPs (IoAllocateIrp).

Irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE,

It looks to me like you are making write requests and not read requests! :wink:

Manoj

PS:

Check out Maxim S. Shatskih’s response to a similar query of mine on Mon, 11 Feb 2002 15:30:43 +0300.

Subject: [ntfsd] Re: Passing down the Read IRP - newbie doubts…

(I don’t know if there is a way of identifying each post to this list - something like an index perhaps!)

Bill Hunt wrote: I’m doing a series of read requests to a USB mass storage driver using
the following sequence of calls (some editing) :

{
KEVENT Event;
PIRP Irp;
IO_STATUS_BLOCK Iosb;

KeInitializeEvent( &Event, NotificationEvent, FALSE );

Irp = IoBuildSynchronousFsdRequest( IRP_MJ_WRITE,
TargetDeviceObject,
Buffer,
NumberOfBytesToRead,
&ByteOffset,
&Event,
&Iosb );

if ( Irp == NULL )
return( STATUS_INSUFFICIENT_RESOURCES ) ;

Status = IoCallDriver( TargetDeviceObject, Irp );

if (Status == STATUS_PENDING) {
KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE,
(PLARGE_INTEGER)NULL );
Status = Iosb.Status;
}


This seems to work for a number of calls. Sometimes IoCallDriver
returns the STATUS_PENDING value but after the event is signaled, the
status value in the
status block indicates success.

However, after one STATUS_PENDING return, the event is never signaled.
The problem occurs at the same read on every run. My code looks
equivalent to a number of samples from the W2000 DDK. I tried replacing

the standard W2000 usbstor.sys driver with one specific to the H/W
device. The no-signal problem is not affected by the driver change.

Has anyone seen a problem like this before? Any suggestions for
possible causes? Or lines of investigation?

Bill Hunt


You are currently subscribed to ntfsd as: xxxxx@yahoo.com
To unsubscribe send a blank email to %%email.unsub%%

-----------------------------------
Manoj Paul Joseph,
Master of Computer Applications (final year student),
School of Computer Science and Engineering,
Anna University,
Chennai (Madras),
India.

---------------------------------

---------------------------------
Download exciting Logos, Picture Messages & Ringtones for your mobile phone