]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Check scheduler for "noop" before setting "noop"
authorGarrett Fields <ghfields@gmail.com>
Wed, 10 Oct 2018 15:46:22 +0000 (11:46 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 10 Oct 2018 15:46:22 +0000 (08:46 -0700)
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

contrib/initramfs/scripts/zfs.in

index c0755a371ac6a2608cc8a480bf1658e278969d60..18c8ca2ad5483b2a14a5e274a89b38dc591347a6 100644 (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