Re: IoMarkIrpPending issue

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



you can makr the irp pending right after 1). once you call
IoMarkIrpPending, you must return STATUS_PENDING, which you are doing in 10)
so you are OK. makring the irp pending at the top of the function
simplifies things abit for you.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Bob" <Bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:723F1F42-F307-4FEC-A2E5-34D838D4CE62@xxxxxxxxxxxxxxxx
My driver is a logical volume driver (e.g. mirroring).
Each logical volume is made up of one or more disk partitions.
The general flow of a read request is as follows:

1) Driver receives a 'logical' I/O request (VolIrp).
(This request may (or may not) translate into multiple
physical I/Os)

2) Driver packages up the I/O request info into a generic
format (VolIo).

3) Driver Passes the VolIo to common code (volume manager).

4) Common code process the VolIo request and generates
one or more physical I/Os (PhysIo)

5) Common code calls the driver to initiate the PhysIo(s).

6) Driver code allocates Irp(s) and Mdl(s) for each PhysIo

7) Driver set an IoCompletionRoutine for each request

8) Driver initiates each I/O with IoCallDriver

9) Driver calls IoMarkIrpPending for VolIrp (logical I/O)

10) Driver returns STATUS_PENDING

< some time later >

11) The Driver I/O completion routine for each PhysIrp collects
some statistics, frees the Mdl, frees the Irp and if
it is the last (or only) PhysIrp generated from the
original VolIrp, it calls IoCompleteRequest for
VolIrp.


The problem I'm having is that _sometimes_ step 11 happens before
step 9 (e.g. for a cached I/O?). When that happens IoMarkIrpPending
gets called on an Irp that has already been completed. (not good)

Question: is there a standard way to handle this or do I need to add
my own synchonization event for each (logical) I/O? (not good either...)

Thanks in advance.





.



Relevant Pages

  • RE: [RFC] Virtual Machine Device Queues(VMDq) support on KVM
    ... and has to be non-blocking since network I/O can take indeterminately ... To guest Virtio-net driver, packets receive corresponding to asynchronous read ... Virtio-net backend service encapsulates multiple vqueue elements into ... multiple AIO control blocks and composes them into one AIO read request. ...
    (Linux-Kernel)
  • Re: Performance regression in scsi sequential throughput (iozone) due to "e084b - page-alloc
    ... A -- remap For stacked devices, incoming i/o is remapped to device below it in the i/o stack. ... G -- get request To send any type of request to a block device, a struct request container must be allocated first. ... I -- inserted A request is being sent to the i/o scheduler for addition to the internal queue and later service by the driver. ... It clearly shows that all latencies once block device layer and device driver are involved are almost equal. ...
    (Linux-Kernel)
  • BH_Atomic and atomic queues question.
    ... my driver is designed to intercept block I/O requests (buffer_head ... I replicate a buffer_head request ... What are the atomic queues, and how are they different from the ...
    (comp.os.linux.development.system)
  • Re: [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6)
    ... using the same work structure that is used by the pending suspend request. ... But when will it do the I/O? ... driver can do the I/O at the end of its runtime_resume callback. ...
    (Linux-Kernel)
  • Re: Personal: Wdm driver ioCalling Wdf driver looking for STATUS_SUCCE
    ... This is because framework always marks the IRP pending and returns ... STATUS_PENDING even when the request is completed synchronously by the ... driver. ...
    (microsoft.public.development.device.drivers)