LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   problem with ending requests asynchronously in my block device driver (https://www.linuxquestions.org/questions/programming-9/problem-with-ending-requests-asynchronously-in-my-block-device-driver-607035/)

cable_plug2000 12-15-2007 05:12 PM

problem with ending requests asynchronously in my block device driver
 
Hi,

I've a block device driver which does the following,

Inside the request function I do something like this:
request(fn) {

while ((req = elv_next_request(q)) != NULL) {
....................set up the request;
spin_unlock_irq(q->queue_lock);
call the transfer(set_up_req) function;
spin_lock_irq(q->queue_lock);
}
spin_unlock_irq (q->queue_lock);
/* allow callback to execute as it needs the lock!!! */
spin_lock_irq (q->queue_lock);


}
and the transfer function calls the scsi_execute_asyn(....) with the callback function doing the end request. So, the ending of the request is done like below:

callback(fn) {

spin_lock_irqsave(q->queue_lock, flags);
if (!end_that_request_first(set_up_req->req, cmpstatus,
set_up_req->req->nr_sectors)) {
add_disk_randomness(...);
end_that_request_last(set_up_req->req,0);
}
spin_unlock_irqrestore(q->queue_lock, flags);
}


This code works fine with most of the kernel versions, but fails on some like , Linux 2.6.18-8.el5-xen

Please help me to find out where I'm going wrong?

when I say 'fails' it just hangs without any error ....I'm using dt(Data test) to write to the disk. The logs show that all the requests that have been sent for processing, have completed sucessfully. Its just that new requests never enter the request function. So, the dt writes almost half the data and then simply hangs.

Thanks in advance for an early reply.
Anil P.


All times are GMT -5. The time now is 04:06 PM.