block: elevator: forbid init from changing I/O scheduler

Userspace sets bfq when booting is done, we do not want this to
happen because we use upstreamed cfq by default.

Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: UtsavisGreat <utsavbalar1231@gmail.com>
This commit is contained in:
Yaroslav Furman
2019-03-20 15:56:48 +03:00
committed by UtsavBalar1231
parent 41de01b33d
commit ed430e1ce5

View File

@@ -90,6 +90,10 @@ static struct elevator_type *elevator_find(const char *name, bool mq)
{
struct elevator_type *e;
/* Forbid init from changing I/O scheduler from default */
if (!strncmp(current->comm, "init", sizeof("init")))
return NULL;
list_for_each_entry(e, &elv_list, list) {
if (!strcmp(e->elevator_name, name) && (mq == e->uses_mq))
return e;