/[packages]/updates/8/kernel/current/SOURCES/block-release-rq-qos-structures-for-queue-without-disk.patch
ViewVC logotype

Contents of /updates/8/kernel/current/SOURCES/block-release-rq-qos-structures-for-queue-without-disk.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1800371 - (show annotations) (download)
Sat Mar 19 15:34:14 2022 UTC (2 years, 1 month ago) by tmb
File size: 1926 byte(s)
add current -stable queue
1 From daaca3522a8e67c46e39ef09c1d542e866f85f3b Mon Sep 17 00:00:00 2001
2 From: Ming Lei <ming.lei@redhat.com>
3 Date: Mon, 14 Mar 2022 12:30:18 +0800
4 Subject: block: release rq qos structures for queue without disk
5
6 From: Ming Lei <ming.lei@redhat.com>
7
8 commit daaca3522a8e67c46e39ef09c1d542e866f85f3b upstream.
9
10 blkcg_init_queue() may add rq qos structures to request queue, previously
11 blk_cleanup_queue() calls rq_qos_exit() to release them, but commit
12 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
13 moves rq_qos_exit() into del_gendisk(), so memory leak is caused
14 because queues may not have disk, such as un-present scsi luns, nvme
15 admin queue, ...
16
17 Fixes the issue by adding rq_qos_exit() to blk_cleanup_queue() back.
18
19 BTW, v5.18 won't need this patch any more since we move
20 blkcg_init_queue()/blkcg_exit_queue() into disk allocation/release
21 handler, and patches have been in for-5.18/block.
22
23 Cc: Christoph Hellwig <hch@lst.de>
24 Cc: stable@vger.kernel.org
25 Fixes: 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
26 Reported-by: syzbot+b42749a851a47a0f581b@syzkaller.appspotmail.com
27 Signed-off-by: Ming Lei <ming.lei@redhat.com>
28 Reviewed-by: Bart Van Assche <bvanassche@acm.org>
29 Reviewed-by: Christoph Hellwig <hch@lst.de>
30 Link: https://lore.kernel.org/r/20220314043018.177141-1-ming.lei@redhat.com
31 Signed-off-by: Jens Axboe <axboe@kernel.dk>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33 ---
34 block/blk-core.c | 4 ++++
35 1 file changed, 4 insertions(+)
36
37 --- a/block/blk-core.c
38 +++ b/block/blk-core.c
39 @@ -49,6 +49,7 @@
40 #include "blk-mq.h"
41 #include "blk-mq-sched.h"
42 #include "blk-pm.h"
43 +#include "blk-rq-qos.h"
44
45 struct dentry *blk_debugfs_root;
46
47 @@ -380,6 +381,9 @@ void blk_cleanup_queue(struct request_qu
48 */
49 blk_freeze_queue(q);
50
51 + /* cleanup rq qos structures for queue without disk */
52 + rq_qos_exit(q);
53 +
54 blk_queue_flag_set(QUEUE_FLAG_DEAD, q);
55
56 blk_sync_queue(q);

  ViewVC Help
Powered by ViewVC 1.1.30