aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-13 01:38:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-13 01:38:32 -0400
commited9ea4ed3a44e8f8e8c7e8a12a05fd73f9ae1fb4 (patch)
treef7275c1cade0a756d5b456dc23ccb692ff6073d5 /drivers/scsi/libiscsi.c
parentc1fdb2d3389c5a1e7c559a37a4967c1d2580e75c (diff)
parent0ed6e189e3f6ac3a25383ed5cc8b0ac24c9b97b7 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "The highlights this round include: - Add support for T10 PI pass-through between vhost-scsi + virtio-scsi (MST + Paolo + MKP + nab) - Add support for T10 PI in qla2xxx target mode (Quinn + MKP + hch + nab, merged through scsi.git) - Add support for percpu-ida pre-allocation in qla2xxx target code (Quinn + nab) - A number of iser-target fixes related to hardening the network portal shutdown path (Sagi + Slava) - Fix response length residual handling for a number of control CDBs (Roland + Christophe V.) - Various iscsi RFC conformance fixes in the CHAP authentication path (Tejas and Calsoft folks + nab) - Return TASK_SET_FULL status for tcm_fc(FCoE) DataIn + Response failures (Vasu + Jun + nab) - Fix long-standing ABORT_TASK + session reset hang (nab) - Convert iser-initiator + iser-target to include T10 bytes into EDTL (Sagi + Or + MKP + Mike Christie) - Fix NULL pointer dereference regression related to XCOPY introduced in v3.15 + CC'ed to v3.12.y (nab)" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (34 commits) target: Fix NULL pointer dereference for XCOPY in target_put_sess_cmd vhost-scsi: Include prot_bytes into expected data transfer length TARGET/sbc,loopback: Adjust command data length in case pi exists on the wire libiscsi, iser: Adjust data_length to include protection information scsi_cmnd: Introduce scsi_transfer_length helper target: Report correct response length for some commands target/sbc: Check that the LBA and number of blocks are correct in VERIFY target/sbc: Remove sbc_check_valid_sectors() Target/iscsi: Fix sendtargets response pdu for iser transport Target/iser: Fix a wrong dereference in case discovery session is over iser iscsi-target: Fix ABORT_TASK + connection reset iscsi_queue_req memory leak target: Use complete_all for se_cmd->t_transport_stop_comp target: Set CMD_T_ACTIVE bit for Task Management Requests target: cleanup some boolean tests target/spc: Simplify INQUIRY EVPD=0x80 tcm_fc: Generate TASK_SET_FULL status for response failures tcm_fc: Generate TASK_SET_FULL status for DataIN failures iscsi-target: Reject mutual authentication with reflected CHAP_C iscsi-target: Remove no-op from iscsit_tpg_del_portal_group iscsi-target: Fix CHAP_A parameter list handling ...
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index ecd7bd304efe..3d1bc67bac9d 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -338,7 +338,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
338 struct iscsi_session *session = conn->session; 338 struct iscsi_session *session = conn->session;
339 struct scsi_cmnd *sc = task->sc; 339 struct scsi_cmnd *sc = task->sc;
340 struct iscsi_scsi_req *hdr; 340 struct iscsi_scsi_req *hdr;
341 unsigned hdrlength, cmd_len; 341 unsigned hdrlength, cmd_len, transfer_length;
342 itt_t itt; 342 itt_t itt;
343 int rc; 343 int rc;
344 344
@@ -391,11 +391,11 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
391 if (scsi_get_prot_op(sc) != SCSI_PROT_NORMAL) 391 if (scsi_get_prot_op(sc) != SCSI_PROT_NORMAL)
392 task->protected = true; 392 task->protected = true;
393 393
394 transfer_length = scsi_transfer_length(sc);
395 hdr->data_length = cpu_to_be32(transfer_length);
394 if (sc->sc_data_direction == DMA_TO_DEVICE) { 396 if (sc->sc_data_direction == DMA_TO_DEVICE) {
395 unsigned out_len = scsi_out(sc)->length;
396 struct iscsi_r2t_info *r2t = &task->unsol_r2t; 397 struct iscsi_r2t_info *r2t = &task->unsol_r2t;
397 398
398 hdr->data_length = cpu_to_be32(out_len);
399 hdr->flags |= ISCSI_FLAG_CMD_WRITE; 399 hdr->flags |= ISCSI_FLAG_CMD_WRITE;
400 /* 400 /*
401 * Write counters: 401 * Write counters:
@@ -414,18 +414,19 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
414 memset(r2t, 0, sizeof(*r2t)); 414 memset(r2t, 0, sizeof(*r2t));
415 415
416 if (session->imm_data_en) { 416 if (session->imm_data_en) {
417 if (out_len >= session->first_burst) 417 if (transfer_length >= session->first_burst)
418 task->imm_count = min(session->first_burst, 418 task->imm_count = min(session->first_burst,
419 conn->max_xmit_dlength); 419 conn->max_xmit_dlength);
420 else 420 else
421 task->imm_count = min(out_len, 421 task->imm_count = min(transfer_length,
422 conn->max_xmit_dlength); 422 conn->max_xmit_dlength);
423 hton24(hdr->dlength, task->imm_count); 423 hton24(hdr->dlength, task->imm_count);
424 } else 424 } else
425 zero_data(hdr->dlength); 425 zero_data(hdr->dlength);
426 426
427 if (!session->initial_r2t_en) { 427 if (!session->initial_r2t_en) {
428 r2t->data_length = min(session->first_burst, out_len) - 428 r2t->data_length = min(session->first_burst,
429 transfer_length) -
429 task->imm_count; 430 task->imm_count;
430 r2t->data_offset = task->imm_count; 431 r2t->data_offset = task->imm_count;
431 r2t->ttt = cpu_to_be32(ISCSI_RESERVED_TAG); 432 r2t->ttt = cpu_to_be32(ISCSI_RESERVED_TAG);
@@ -438,7 +439,6 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
438 } else { 439 } else {
439 hdr->flags |= ISCSI_FLAG_CMD_FINAL; 440 hdr->flags |= ISCSI_FLAG_CMD_FINAL;
440 zero_data(hdr->dlength); 441 zero_data(hdr->dlength);
441 hdr->data_length = cpu_to_be32(scsi_in(sc)->length);
442 442
443 if (sc->sc_data_direction == DMA_FROM_DEVICE) 443 if (sc->sc_data_direction == DMA_FROM_DEVICE)
444 hdr->flags |= ISCSI_FLAG_CMD_READ; 444 hdr->flags |= ISCSI_FLAG_CMD_READ;
@@ -466,7 +466,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
466 scsi_bidi_cmnd(sc) ? "bidirectional" : 466 scsi_bidi_cmnd(sc) ? "bidirectional" :
467 sc->sc_data_direction == DMA_TO_DEVICE ? 467 sc->sc_data_direction == DMA_TO_DEVICE ?
468 "write" : "read", conn->id, sc, sc->cmnd[0], 468 "write" : "read", conn->id, sc, sc->cmnd[0],
469 task->itt, scsi_bufflen(sc), 469 task->itt, transfer_length,
470 scsi_bidi_cmnd(sc) ? scsi_in(sc)->length : 0, 470 scsi_bidi_cmnd(sc) ? scsi_in(sc)->length : 0,
471 session->cmdsn, 471 session->cmdsn,
472 session->max_cmdsn - session->exp_cmdsn + 1); 472 session->max_cmdsn - session->exp_cmdsn + 1);