diff options
author | Jens Axboe <axboe@fb.com> | 2017-02-14 08:16:41 -0700 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-14 08:16:41 -0700 |
commit | d1a987f35ebf859a771ac530e95a89933b6fcce8 (patch) | |
tree | 15b2ba0c3125623a5b2ed4fb48a5090ca58a6a1b /block | |
parent | c5c9b26ee5f1295c77d8f2ff5f804ed6c0b07cc4 (diff) | |
download | lwn-d1a987f35ebf859a771ac530e95a89933b6fcce8.tar.gz lwn-d1a987f35ebf859a771ac530e95a89933b6fcce8.zip |
elevator: fix loading wrong elevator type for blk-mq devices
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/elevator.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/block/elevator.c b/block/elevator.c index ef7f59469acc..b2a55167f0c2 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -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", |