t/zbd: Fix a bug in max_open_zones()
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 13 Apr 2020 08:32:58 +0000 (17:32 +0900)
committerJens Axboe <axboe@kernel.dk>
Mon, 13 Apr 2020 14:22:10 +0000 (08:22 -0600)
When sg_inq command is executed to check if it can provide maximum open
zones, the command's standard output was not discarded and caused
unexpected script behavior. Fix it discarding the standard output.

Reviewed-by: Damien Le Moal <damien.lemoaal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/zbd/functions

index 35087b1597c04651c408787b7783827254947522..5bffad6ee53af69857b2b076d2f7b09f14d0437f 100644 (file)
@@ -43,7 +43,8 @@ max_open_zones() {
     local dev=$1
 
     if [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then
     local dev=$1
 
     if [ -n "${sg_inq}" ] && [ ! -n "${use_libzbc}" ]; then
-       if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" 2> /dev/null; then
+       if ! ${sg_inq} -e --page=0xB6 --len=20 --hex "$dev" \
+                > /dev/null 2>&1; then
            # Non scsi device such as null_blk can not return max open zones.
            # Use default value.
            echo 128
            # Non scsi device such as null_blk can not return max open zones.
            # Use default value.
            echo 128