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@xxxxxxx> Fixes: 734e1a860312 ("block: Prevent deadlocks when switching elevators") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx> --- 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