Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+5 -4
+5 -4
block/elevator.c
··· 207 207 } 208 208 209 209 /* 210 - * Use the default elevator specified by config boot param or 211 - * config option. Don't try to load modules as we could be running 212 - * off async and request_module() isn't allowed from async. 210 + * Use the default elevator specified by config boot param for 211 + * non-mq devices, or by config option. Don't try to load modules 212 + * as we could be running off async and request_module() isn't 213 + * allowed from async. 213 214 */ 214 - if (!e && *chosen_elevator) { 215 + if (!e && !q->mq_ops && *chosen_elevator) { 215 216 e = elevator_get(chosen_elevator, false); 216 217 if (!e) 217 218 printk(KERN_ERR "I/O scheduler %s not found\n",