block: Fix elv_iosched_local_module handling of "none" scheduler

Commit 734e1a8603 ("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 ignoring the return value of the request_module() call
done by elv_iosched_load_module(). This restores the behavior before
commit 734e1a8603, which was to ignore the request_module() result and
instead rely on elevator_change() to handle the "none" scheduler case.

Reported-by: Shin'ichiro Kawasaki <[email protected]>
Fixes: 734e1a8603 ("block: Prevent deadlocks when switching elevators")
Cc: [email protected]
Signed-off-by: Damien Le Moal <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Damien Le Moal authored and Jens Axboe committed 2024-09-17 08:34:00 -06:00
1 parent 42b16d3ac3
commit e3accac1a9
1 file changed
+3 -1
+3 -1
View File
@@ -715,7 +715,9 @@ int elv_iosched_load_module(struct gendisk *disk, const char *buf,
strscpy(elevator_name, buf, sizeof(elevator_name));
return request_module("%s-iosched", strstrip(elevator_name));
request_module("%s-iosched", strstrip(elevator_name));
return 0;
}
ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,