mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] blk-mq: put the reference of the io scheduler module after switching back
@ 2022-10-12  0:35 Jinlong Chen
  2022-10-13 13:03 ` [PATCH] " Jinlong Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Jinlong Chen @ 2022-10-12  0:35 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Jinlong Chen

We got a reference of the io scheduler module in
blk_mq_elv_switch_none to prevent the module from
being removed. We need to put that reference back
once we are done.

Signed-off-by: Jinlong Chen <chenjinlong2016@outlook.com>
---
---
Changes in v2:
 - reword the commit message because the patch is for blk-mq precisely 

 block/blk-mq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8070b6c10e8d..8dfe3bf3e599 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4595,6 +4595,13 @@ static void blk_mq_elv_switch_back(struct list_head *head,
 
 	mutex_lock(&q->sysfs_lock);
 	elevator_switch(q, t);
+	/**
+	 * We got a reference of the io scheduler module in
+	 * blk_mq_elv_switch_none to prevent the module from
+	 * being removed. We need to put that reference back
+	 * once we are done.
+	 */
+	module_put(t->elevator_owner);
 	mutex_unlock(&q->sysfs_lock);
 }
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-14  7:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12  0:35 [PATCH v2] blk-mq: put the reference of the io scheduler module after switching back Jinlong Chen
2022-10-13 13:03 ` [PATCH] " Jinlong Chen
2022-10-13 13:22   ` Yu Kuai
2022-10-13 13:47     ` Jinlong Chen
2022-10-13 14:05       ` Yu Kuai
2022-10-13 14:18         ` Jinlong Chen
2022-10-14  7:27           ` Yu Kuai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®