From 5b3bfd86a4acd0fd572802de6eb8bfed322dd470 Mon Sep 17 00:00:00 2001 From: Garrett Fields Date: Wed, 10 Oct 2018 11:46:22 -0400 Subject: [PATCH] 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 Reviewed-by: Tony Hutter Reviewed-by: George Melikov Reviewed-by: Richard Elling Signed-off-by: Garrett Fields Closes #8004 --- contrib/initramfs/scripts/zfs.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/initramfs/scripts/zfs.in b/contrib/initramfs/scripts/zfs.in index c0755a371..18c8ca2ad 100644 --- a/contrib/initramfs/scripts/zfs.in +++ b/contrib/initramfs/scripts/zfs.in @@ -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