Skip to content

Commit

Permalink
Target/iscsi: Fix sendtargets response pdu for iser transport
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sagi Grimberg authored and Nicholas Bellinger committed Jun 11, 2014
1 parent e0546fc commit 22c7aaa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/ulp/isert/ib_isert.c
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
int rc;

isert_create_send_desc(isert_conn, isert_cmd, &isert_cmd->tx_desc);
rc = iscsit_build_text_rsp(cmd, conn, hdr);
rc = iscsit_build_text_rsp(cmd, conn, hdr, ISCSI_INFINIBAND);
if (rc < 0)
return rc;

Expand Down
14 changes: 10 additions & 4 deletions drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -3389,7 +3389,9 @@ static bool iscsit_check_inaddr_any(struct iscsi_np *np)

#define SENDTARGETS_BUF_LIMIT 32768U

static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
static int
iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
enum iscsit_transport_type network_transport)
{
char *payload = NULL;
struct iscsi_conn *conn = cmd->conn;
Expand Down Expand Up @@ -3466,6 +3468,9 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
struct iscsi_np *np = tpg_np->tpg_np;
bool inaddr_any = iscsit_check_inaddr_any(np);

if (np->np_network_transport != network_transport)
continue;

if (!target_name_printed) {
len = sprintf(buf, "TargetName=%s",
tiqn->tiqn);
Expand Down Expand Up @@ -3517,11 +3522,12 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)

int
iscsit_build_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn,
struct iscsi_text_rsp *hdr)
struct iscsi_text_rsp *hdr,
enum iscsit_transport_type network_transport)
{
int text_length, padding;

text_length = iscsit_build_sendtargets_response(cmd);
text_length = iscsit_build_sendtargets_response(cmd, network_transport);
if (text_length < 0)
return text_length;

Expand Down Expand Up @@ -3559,7 +3565,7 @@ static int iscsit_send_text_rsp(
u32 tx_size = 0;
int text_length, iov_count = 0, rc;

rc = iscsit_build_text_rsp(cmd, conn, hdr);
rc = iscsit_build_text_rsp(cmd, conn, hdr, ISCSI_TCP);
if (rc < 0)
return rc;

Expand Down
3 changes: 2 additions & 1 deletion include/target/iscsi/iscsi_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
struct iscsi_tm_rsp *);
extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
struct iscsi_text_rsp *);
struct iscsi_text_rsp *,
enum iscsit_transport_type);
extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
struct iscsi_reject *);
extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
Expand Down

0 comments on commit 22c7aaa

Please sign in to comment.