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: utsavbalar1231 <utsavbalar1231@gmail.com>
Signed-off-by: Carlos Jimenez (JavaShin-X) <javashin1986@gmail.com>
This commit is contained in:
Yaroslav Furman 2020-10-25 17:08:54 -04:00 committed by Cyber Knight
parent 63253831bc
commit 46e793402b
No known key found for this signature in database
GPG Key ID: 23BD4CCD326E9D64
1 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,11 @@ 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;