Question

I'm writing a block device driver for a hot-pluggable PCI memory device on 2.6.43.2-6.fc15 (so LDD3 is out of date with respect to a lot of functions) and I'm having trouble getting the block device de-registration to go smoothly. When the device is removed, I go to tear down the gendisk and request_queue, but it hangs on blk_cleanup_queue(). Presumably there's some queue-related process I have neglected to carry out before that, but I can't see any major consistent differences with other block drivers from that kernel tree that i am using for reference (memstick, cciss, etc). What are the steps I should carry out before going to tidy up the queue and gendisk?

I am implementing .open, .release, .ioctl in the block_ops as well as a mydev_request(struct request_queue *q) attached with blk_init_queue(mydev_request, &mydev->lock), but I'm not sure exactly how to tidy the queue either when requests occur or when de-registering the block device.

Était-ce utile?

La solution

This is caused by not ending the requests that you fetch off the queue. To fix it, end the request as follows:

while ((req = blk_fetch_request(q)) != NULL )
{
    res = mydev_submit_request_sg(mydev, req);

    if (res)
        __blk_end_request_all(req, res);
    else
        __blk_end_request_cur (req, res);
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top