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:
Bart Van Assche
2014-08-18 08:37:30 +02:00
committed by Ronnie Sahlberg
parent e8c4be8f62
commit ded75ae18a
6 changed files with 22 additions and 15 deletions

View File

@@ -1518,7 +1518,8 @@ iscsi_writesame10_task(struct iscsi_context *iscsi, int lun, uint32_t lba,
struct scsi_task *task;
struct iscsi_data d;
task = scsi_cdb_writesame10(wrprotect, anchor, unmap, lba, group, num_blocks);
task = scsi_cdb_writesame10(wrprotect, anchor, unmap, lba, group,
num_blocks, datalen);
if (task == NULL) {
iscsi_set_error(iscsi, "Out-of-memory: Failed to create "
"writesame10 cdb.");
@@ -1551,7 +1552,8 @@ iscsi_writesame16_task(struct iscsi_context *iscsi, int lun, uint64_t lba,
struct scsi_task *task;
struct iscsi_data d;
task = scsi_cdb_writesame16(wrprotect, anchor, unmap, lba, group, num_blocks);
task = scsi_cdb_writesame16(wrprotect, anchor, unmap, lba, group,
num_blocks, datalen);
if (task == NULL) {
iscsi_set_error(iscsi, "Out-of-memory: Failed to create "
"writesame16 cdb.");