Check scheduler for "noop" before setting "noop"

Originally code only checked for presence of "/sys/block/$i/queue/
scheduler".  "sh: write error: Invalid argument" was produced when
trying to set "noop" on certain devices (eg. virtio) when it isn't
a listed option. This modification continues to check for the presence
of "/sys/block/$i/queue/scheduler" and also checks that it contains
"noop" as an option before setting "noop".

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Signed-off-by: Garrett Fields <ghfields@gmail.com>
Closes #8004
This commit is contained in:
Garrett Fields 2018-10-10 11:46:22 -04:00 committed by Brian Behlendorf
parent 2ef0f8c329
commit 5b3bfd86a4
1 changed files with 1 additions and 1 deletions

View File

@ -900,7 +900,7 @@ mountroot()
}' |
while read i
do
if [ -e "/sys/block/$i/queue/scheduler" ]
if grep -sq noop /sys/block/$i/queue/scheduler
then
echo noop > "/sys/block/$i/queue/scheduler"
fi