aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2014-06-10 11:27:59 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2014-06-11 14:52:39 -0400
commit22c7aaa57e80853b4904a46c18f97db0036a3b97 (patch)
tree480f5c1c0277c263e03e2c039e5c03b3fe3303ca /drivers/target
parente0546fc1ba66c90cb38a5764357366267d3e58e4 (diff)
Target/iscsi: Fix sendtargets response pdu for iser transport
In case the transport is iser we should not include the iscsi target info in the sendtargets text response pdu. This causes sendtargets response to include the target info twice. Modify iscsit_build_sendtargets_response to filter transport types that don't match. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Reported-by: Slava Shwartsman <valyushash@gmail.com> Cc: stable@vger.kernel.org # 3.11+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index e0d98344e4bd..b87721a01b74 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3389,7 +3389,9 @@ static bool iscsit_check_inaddr_any(struct iscsi_np *np)
3389 3389
3390#define SENDTARGETS_BUF_LIMIT 32768U 3390#define SENDTARGETS_BUF_LIMIT 32768U
3391 3391
3392static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) 3392static int
3393iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
3394 enum iscsit_transport_type network_transport)
3393{ 3395{
3394 char *payload = NULL; 3396 char *payload = NULL;
3395 struct iscsi_conn *conn = cmd->conn; 3397 struct iscsi_conn *conn = cmd->conn;
@@ -3466,6 +3468,9 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
3466 struct iscsi_np *np = tpg_np->tpg_np; 3468 struct iscsi_np *np = tpg_np->tpg_np;
3467 bool inaddr_any = iscsit_check_inaddr_any(np); 3469 bool inaddr_any = iscsit_check_inaddr_any(np);
3468 3470
3471 if (np->np_network_transport != network_transport)
3472 continue;
3473
3469 if (!target_name_printed) { 3474 if (!target_name_printed) {
3470 len = sprintf(buf, "TargetName=%s", 3475 len = sprintf(buf, "TargetName=%s",
3471 tiqn->tiqn); 3476 tiqn->tiqn);
@@ -3517,11 +3522,12 @@ eob:
3517 3522
3518int 3523int
3519iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn, 3524iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn,
3520 struct iscsi_text_rsp *hdr) 3525 struct iscsi_text_rsp *hdr,
3526 enum iscsit_transport_type network_transport)
3521{ 3527{
3522 int text_length, padding; 3528 int text_length, padding;
3523 3529
3524 text_length = iscsit_build_sendtargets_response(cmd); 3530 text_length = iscsit_build_sendtargets_response(cmd, network_transport);
3525 if (text_length < 0) 3531 if (text_length < 0)
3526 return text_length; 3532 return text_length;
3527 3533
@@ -3559,7 +3565,7 @@ static int iscsit_send_text_rsp(
3559 u32 tx_size = 0; 3565 u32 tx_size = 0;
3560 int text_length, iov_count = 0, rc; 3566 int text_length, iov_count = 0, rc;
3561 3567
3562 rc = iscsit_build_text_rsp(cmd, conn, hdr); 3568 rc = iscsit_build_text_rsp(cmd, conn, hdr, ISCSI_TCP);
3563 if (rc < 0) 3569 if (rc < 0)
3564 return rc; 3570 return rc;
3565 3571