blk

编程入门 行业动态 更新时间:2024-10-28 18:26:37
blk_cleanup_queue()在块设备注销时不返回(blk_cleanup_queue() doesn't return on block device deregistration)

我正在为2.6.43.2-6.fc15上的热插拔PCI存储设备编写块设备驱动程序(因此LDD3与许多功能相比已经过时)而且我无法获得块设备de - 注册顺利。 当设备被删除时,我会拆除gendisk和request_queue,但它挂起在blk_cleanup_queue() 。 据推测,在此之前我忽略了一些与队列相关的进程,但我看不出与我用于参考的内核树中的其他块驱动程序有任何重大的一致差异( memstick , cciss等)。 在整理队列和gendisk之前我应该​​执行哪些步骤?

我在.open实现.open , .release , .ioctl以及与blk_init_queue(mydev_request, &mydev->lock)附加的mydev_request(struct request_queue *q) blk_init_queue(mydev_request, &mydev->lock) ,但我不确定如何整理队列当请求发生时或取消注册块设备时。

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.

最满意答案

这是因为没有结束您从队列中获取的请求。 要解决此问题,请按以下方式结束请求:

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); }

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); }

更多推荐

本文发布于:2023-08-04 11:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1414906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:blk

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!