If request_module() failed then it seems no reason to lookup the iosched again, so add a check to handle this case. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx> --- block/elevator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index 8fdcd64ae12e..f89527951243 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -124,7 +124,9 @@ static struct elevator_type *elevator_get(struct request_queue *q, e = elevator_find(name, q->mq_ops != NULL); if (!e && try_loading) { spin_unlock(&elv_list_lock); - request_module("%s-iosched", name); + if (request_module("%s-iosched", name)) + return e; + spin_lock(&elv_list_lock); e = elevator_find(name, q->mq_ops != NULL); } -- 2.17.2