Use exit instead of return to abort the scripts if modprobe null_blk
fails. With return, the script continues to run after printing an error
message. Also abort if the null block device setup fails for the regular
null block device test script.
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done
modprobe -r null_blk
-modprobe null_blk nr_devices=0 || return $?
+modprobe null_blk nr_devices=0 || exit $?
for d in /sys/kernel/config/nullb/*; do
[ -d "$d" ] && rmdir "$d"
done
echo 4096 > blocksize &&
echo 1024 > size &&
echo 1 > memory_backed &&
- echo 1 > power
+ echo 1 > power || exit $?
"${scriptdir}"/test-zbd-support "$@" /dev/nullb0
for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done
modprobe -r null_blk
-modprobe null_blk nr_devices=0 || return $?
+modprobe null_blk nr_devices=0 || exit $?
for d in /sys/kernel/config/nullb/*; do
[ -d "$d" ] && rmdir "$d"
done