linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Fix elv_iosched_local_module handling of "none" scheduler
@ 2024-09-17  5:32 Damien Le Moal
  2024-09-17  5:53 ` Christoph Hellwig
  2024-09-17 11:55 ` Shinichiro Kawasaki
  0 siblings, 2 replies; 12+ messages in thread
From: Damien Le Moal @ 2024-09-17  5:32 UTC (permalink / raw)
  To: Jens Axboe, linux-block
  Cc: Richard W . M . Jones, Ming Lei, Jeff Moyer, Jiri Jaburek,
	Christoph Hellwig, Bart Van Assche, Hannes Reinecke,
	Chaitanya Kulkarni, Shin'ichiro Kawasaki

Commit 734e1a860312 ("block: Prevent deadlocks when switching
elevators") introduced the function elv_iosched_load_module() to allow
loading an elevator module outside of elv_iosched_store() with the
target device queue not frozen, to avoid deadlocks. However, the "none"
scheduler does not have a module and as a result,
elv_iosched_load_module() always returns an error when trying to switch
to this valid scheduler.

Fix this by checking that the requested scheduler is "none" and doing
nothing in that case.

Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: 734e1a860312 ("block: Prevent deadlocks when switching elevators")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 block/elevator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/elevator.c b/block/elevator.c
index c355b55d0107..d0ee9c0aaed2 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -714,6 +714,8 @@ int elv_iosched_load_module(struct gendisk *disk, const char *buf,
 		return -EOPNOTSUPP;
 
 	strscpy(elevator_name, buf, sizeof(elevator_name));
+	if (!strncmp(elevator_name, "none", 4))
+		return 0;
 
 	return request_module("%s-iosched", strstrip(elevator_name));
 }
-- 
2.46.0


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

end of thread, other threads:[~2024-09-17 13:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17  5:32 [PATCH] block: Fix elv_iosched_local_module handling of "none" scheduler Damien Le Moal
2024-09-17  5:53 ` Christoph Hellwig
2024-09-17 12:33   ` Ming Lei
2024-09-17 12:48     ` Damien Le Moal
2024-09-17 13:02       ` Ming Lei
2024-09-17 13:05         ` Christoph Hellwig
2024-09-17 13:11           ` Jens Axboe
2024-09-17 13:14             ` Christoph Hellwig
2024-09-17 13:17               ` Jens Axboe
2024-09-17 13:18               ` Damien Le Moal
2024-09-17 13:19                 ` Jens Axboe
2024-09-17 11:55 ` Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).