Fix WRITE SAME data buffer length handling
From the SPC-4 paragraph about WRITE SAME(10): "The WRITE SAME (10) command requests that the device server transfer a single logical block from the Data-Out Buffer [ ... ]". Hence always pass a data buffer when sending a WRITE SAME(10) command. Set the NDOB bit in the WRITE SAME(16) command if no data out buffer is present. Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
e8c4be8f62
commit
ded75ae18a
@@ -27,6 +27,7 @@ void
|
||||
test_writesame10_0blocks(void)
|
||||
{
|
||||
int ret;
|
||||
unsigned char *buf = alloca(block_size);
|
||||
|
||||
CHECK_FOR_DATALOSS;
|
||||
CHECK_FOR_SBC;
|
||||
@@ -41,7 +42,7 @@ test_writesame10_0blocks(void)
|
||||
inq_bl->wsnz);
|
||||
ret = writesame10(iscsic, tgt_lun, 0,
|
||||
block_size, 0,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, 0, 0, 0, buf);
|
||||
if (ret == -2) {
|
||||
CU_PASS("[SKIPPED] Target does not support WRITESAME10. Skipping test");
|
||||
return;
|
||||
@@ -60,20 +61,20 @@ test_writesame10_0blocks(void)
|
||||
logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks one block past end-of-LUN");
|
||||
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1,
|
||||
block_size, 0,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==2^31");
|
||||
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
|
||||
block_size, 0,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
|
||||
|
||||
logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==-1");
|
||||
ret = writesame10_lbaoutofrange(iscsic, tgt_lun, -1,
|
||||
block_size, 0,
|
||||
0, 0, 0, 0, NULL);
|
||||
0, 0, 0, 0, buf);
|
||||
CU_ASSERT_EQUAL(ret, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user