Skip to contentSkip to conversation

blk: do rq_qos_exit in blk_cleanup_queue

PATCH Applied Wang Jianchao (Kuaishou) 4 participants 8 messages Feb 16, 2022 – Feb 17, 2022 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk: do rq_qos_exit in blk_cleanup_queue

From: Wang Jianchao <[email protected]>

When __alloc_disk_node() failed, there will not not del_gendisk() any more, then resource in rqos policies is leaked. Add rq_qos_exit() into blk_cleanup_queue(). rqos is removed from the list, so needn't to worry .exit is called twice.

Fixes commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
---
 block/blk-core.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-core.c +3 -0
index d93e3bb9a769..108c7207d048 100644
@@ -50,6 +50,7 @@
 #include "blk-mq-sched.h"
 #include "blk-pm.h"
 #include "blk-throttle.h"
+#include "blk-rq-qos.h"
 
 struct dentry *blk_debugfs_root;
 
@@ -322,6 +323,8 @@ void blk_cleanup_queue(struct request_queue *q)
 
 	blk_queue_flag_set(QUEUE_FLAG_DEAD, q);
 
+	rq_qos_exit(q);
+
 	blk_sync_queue(q);
 	if (queue_is_mq(q)) {
 		blk_mq_cancel_work_sync(q);
Signature · 1 line
2.17.1
maintainer Applied
#2 lore raw
In reply to Wang Jianchao (Kuaishou)
Quoted 8 lines · Wang Jianchao (Kuaishou)

From: Wang Jianchao <[email protected]>

When __alloc_disk_node() failed, there will not not del_gendisk() any more, then resource in rqos policies is leaked. Add rq_qos_exit() into blk_cleanup_queue(). rqos is removed from the list, so needn't to worry .exit is called twice.

[...]

Applied, thanks!

[1/1] blk: do rq_qos_exit in blk_cleanup_queue

      commit: 20d41d9e993735b996175d087148d9de1fc94ac0

Best regards,

Signature · 1 line
Jens Axboe
#3 lore raw
In reply to Wang Jianchao (Kuaishou)
Quoted 10 lines · Wang Jianchao (Kuaishou)

From: Wang Jianchao <[email protected]>

When __alloc_disk_node() failed, there will not not del_gendisk() any more, then resource in rqos policies is leaked. Add rq_qos_exit() into blk_cleanup_queue(). rqos is removed from the list, so needn't to worry .exit is called twice.

Fixes commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")

Ming had a pending patch to move it into disk_release instead, which I think is the right place.

maintainer
#4 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines · Wang Jianchao (Kuaishou)

From: Wang Jianchao <[email protected]>

When __alloc_disk_node() failed, there will not not del_gendisk() any more, then resource in rqos policies is leaked. Add rq_qos_exit() into blk_cleanup_queue(). rqos is removed from the list, so needn't to worry .exit is called twice.

Quoted 6 lines
Quoted 3 lines
Fixes commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")

Ming had a pending patch to move it into disk_release instead, which I think is the right place.

I missed that patch and can't seem to find it, do you have a link?

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 9 lines · Jens Axboe
Quoted 8 lines · Christoph Hellwig
Quoted 7 lines · Wang Jianchao (Kuaishou)

From: Wang Jianchao <[email protected]>

When __alloc_disk_node() failed, there will not not del_gendisk() any more, then resource in rqos policies is leaked. Add rq_qos_exit() into blk_cleanup_queue(). rqos is removed from the list, so needn't to worry .exit is called twice.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Fixes commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")

Ming had a pending patch to move it into disk_release instead, which I think is the right place.

I missed that patch and can't seem to find it, do you have a link?

[PATCH V2 12/13] block: move rq_qos_exit() into disk_release()

from Jan 22. Although it would need a rebase so it can be applied without the preceding patches.

maintainer
#6 lore raw
Quoted 17 lines · Christoph Hellwig
Quoted 16 lines · Jens Axboe
Quoted 14 lines · Christoph Hellwig
Quoted 10 lines · Wang Jianchao (Kuaishou)

From: Wang Jianchao <[email protected]>

When __alloc_disk_node() failed, there will not not del_gendisk() any more, then resource in rqos policies is leaked. Add rq_qos_exit() into blk_cleanup_queue(). rqos is removed from the list, so needn't to worry .exit is called twice.

Fixes commit 8e141f9eb803 ("block: drain file system I/O on del_gendisk")

Ming had a pending patch to move it into disk_release instead, which I think is the right place.

Quoted 6 lines
Quoted 1 line

I missed that patch and can't seem to find it, do you have a link?

[PATCH V2 12/13] block: move rq_qos_exit() into disk_release()

from Jan 22. Although it would need a rebase so it can be applied without the preceding patches.

Can someone respin that for 5.17 then?

Signature · 1 line
Jens Axboe
#7 lore raw
Quoted 4 lines · Jens Axboe
Quoted 2 lines

from Jan 22. Although it would need a rebase so it can be applied without the preceding patches.

Can someone respin that for 5.17 then?

I looked at it and it I don't think we can do that without a lot of the prep patches.

That being said I think this version of the patch also is buggy, we want the policies shut down in del_gendisk with the queue frozen for normal operation.

I guess until we can move the initialization and teardown entirely to the gendisk as in Ming's more complex series we need to keep the call in del_gendisk and also do it in blk_cleanup_queue. For the normal shutdown on disk that were life del_gendisk does the all the work on the frozen queue, while for queues that never had a disk blk_cleanup_queue will clean up the unused rq_qos.