diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index c36178fff..d22412f21 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -1070,6 +1070,9 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task) if (spdk_iscsi_task_is_read(primary)) { process_read_task_completion(conn, task, primary); } else { + if (task != primary) { + primary->scsi.data_transferred += task->scsi.data_transferred; + } primary->bytes_completed += task->scsi.length; if ((task != primary) && (task->scsi.status != SPDK_SCSI_STATUS_GOOD)) { diff --git a/lib/scsi/scsi_bdev.c b/lib/scsi/scsi_bdev.c index 02dcd2185..fe66708b9 100644 --- a/lib/scsi/scsi_bdev.c +++ b/lib/scsi/scsi_bdev.c @@ -1362,7 +1362,6 @@ spdk_bdev_scsi_write(struct spdk_bdev *bdev, uint64_t offset; uint64_t nbytes; int rc; - struct spdk_scsi_task *primary = task->parent; blen = spdk_bdev_get_block_size(bdev); offset = lba * blen; @@ -1395,17 +1394,12 @@ spdk_bdev_scsi_write(struct spdk_bdev *bdev, SPDK_SCSI_ASC_NO_ADDITIONAL_SENSE, SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE); return SPDK_SCSI_TASK_COMPLETE; - } else { - if (!primary) { - task->data_transferred += task->length; - } else { - primary->data_transferred += task->length; - } } SPDK_DEBUGLOG(SPDK_LOG_SCSI, "Wrote %"PRIu64"/%"PRIu64" bytes\n", (uint64_t)task->length, nbytes); + task->data_transferred = task->length; task->status = SPDK_SCSI_STATUS_GOOD; return SPDK_SCSI_TASK_PENDING; } @@ -1456,6 +1450,8 @@ spdk_bdev_scsi_readwrite(struct spdk_bdev *bdev, { uint32_t max_xfer_len; + task->data_transferred = 0; + if (task->dxfer_dir != SPDK_SCSI_DIR_NONE && task->dxfer_dir != (is_read ? SPDK_SCSI_DIR_FROM_DEV : SPDK_SCSI_DIR_TO_DEV)) { SPDK_ERRLOG("Incorrect data direction\n");