IOCTLs failing with ERROR_BUSY

Hi

I wrote a user mode application that sends IOCTL to my storport Miniport driver. It works fine as long as the miniport was not busy (meaning less or NO IOs are running). If I increase the number of IOs through IOMeter, the IOCTLs are started failing with ERROR_BUSY. The IOCTLs were never delivered to miniport. I guess this error may be generated by either IOManger or Storport. If I stop the IOMeter or reduce the number of IOs then the IOCTLs come to miniport. My initial implementation was synchronous way of completion (without Overlap flag set in CreateFile).

Then I implemented the asynchronous way of completion by adding the FILE_FLAG_OVERLAPPED in CreateFile. But

  1. Still the IOCTLs are getting completed synchronously even though the overlap flag is set. Look below, the Status is coming TRUE always (not ERROR_IO_PENDING).
  2. And still get the ERROR_BUSY if I increase the IOs.

Synchronous or Asynchronous, the IOCTL should go to the Miniport even under heavy IOs. What is wrong?

hDevice = CreateFile (
pDeviceName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING,
NULL
);

hEvent = CreateEvent(NULL, TRUE, FALSE, ?MyEvent?);

memset(&Overlap,0,sizeof(OVERLAPPED));
Overlap.hEvent = hEvent;

Status = DeviceIoControl(hDevice,
IOCTL_SCSI_MINIPORT,
pIoctl,
IoctlBufferSize,
pIoctl,
IoctlBufferSize,
&ReqSize,
&Overlap);

ErrorCode = GetLastError();

if (ErrorCode == ERROR_IO_PENDING)
{
Status =
GetOverlappedResult(hDevice,&Overlap,&ReqSize,TRUE);
ErrorCode = GetLastError();
}