From 69c4783d2d6c04ba7b17f6f78fb975f443e81569 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 22 Dec 2019 09:27:32 -0800 Subject: [PATCH] test-tool: Give up if READ CAPACITY reports that the block size is zero Since the test tool can't proceed in a meaningful way if the block size is zero, give up if the SCSI target reports that the block size is zero. Signed-off-by: Bart Van Assche --- test-tool/iscsi-test-cu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index 7a94c59..f2b9813 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -1301,6 +1301,10 @@ main(int argc, char *argv[]) block_size = rc10->block_size; num_blocks = rc10->lba + 1; scsi_free_scsi_task(task); + if (block_size == 0) { + printf("block_size is zero - giving up.\n"); + goto err_sds_free; + } rc16_task = NULL; readcapacity16(sd, &rc16_task, 96, EXPECT_STATUS_GOOD); @@ -1318,6 +1322,10 @@ main(int argc, char *argv[]) block_size = rc16->block_length; num_blocks = rc16->returned_lba + 1; lbppb = 1 << rc16->lbppbe; + if (block_size == 0) { + printf("block_size is zero - giving up.\n"); + goto err_sds_free; + } } /* create a really big buffer we can use in the tests */