Skip to content

Commit

Permalink
elevator: fix loading wrong elevator type for blk-mq devices
Browse files Browse the repository at this point in the history
The old elevator= boot parameter blindly attempts to load the
same scheduler for mq and !mq devices, leading to a crash if
we specify the wrong one.

Ensure that we only apply this boot parameter to old !mq devices.

Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
axboe committed Feb 14, 2017
1 parent c5c9b26 commit d1a987f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ int elevator_init(struct request_queue *q, char *name)
}

/*
* Use the default elevator specified by config boot param or
* config option. Don't try to load modules as we could be running
* off async and request_module() isn't allowed from async.
* Use the default elevator specified by config boot param for
* non-mq devices, or by config option. Don't try to load modules
* as we could be running off async and request_module() isn't
* allowed from async.
*/
if (!e && *chosen_elevator) {
if (!e && !q->mq_ops && *chosen_elevator) {
e = elevator_get(chosen_elevator, false);
if (!e)
printk(KERN_ERR "I/O scheduler %s not found\n",
Expand Down

0 comments on commit d1a987f

Please sign in to comment.