[PATCH 0/2] iser-target: discovery fixes for v3.11-rc1

11 views
Skip to first unread message

Nicholas A. Bellinger

unread,
Jul 7, 2013, 9:22:13 PM7/7/13
to target-devel, Or Gerlitz, Mike Christie, Nicholas Bellinger
From: Nicholas Bellinger <n...@linux-iscsi.org>

Hi Or,

Here are two more iser-target discovery related patches that I'm
including into for-next code now..

The first adds an explicit connection reset when CM disconnect
occurs and starts isert_disconnect_work(). This is required
for local session reinstatement of per-connection rx/tx thread
pairs to be triggered during SessionType=Discovery, and addresses
a bug where discovery sessions are being leaked if no logout
request is sent before isert_disconnect_work() is called.

The second adds an explicit check to drop non TEXT + LOGOUT
opcodes when SessionType=Discovery is negotiated, following
traditional iscsi-target code to ensure that no SCSI PDUs are
processed during in-band discovery.

FYI, I'm folding the first patch into:

Fix session reset bug with RDMA_CM_EVENT_DISCONNECTED

as a connection reset should be forced during SessionType=Normal
as well ahead of a new client login request forcing local session
reinstatement to occur.

Thanks!

--nab

Nicholas Bellinger (2):
iser-target: Add connection reset during CM disconnect
iser-target: Ignore non TEXT + LOGOUT opcodes for discovery

drivers/infiniband/ulp/isert/ib_isert.c | 11 +++++++++++
drivers/target/iscsi/iscsi_target_erl0.c | 1 +
include/target/iscsi/iscsi_transport.h | 4 ++++
3 files changed, 16 insertions(+), 0 deletions(-)

--
1.7.2.5

Nicholas A. Bellinger

unread,
Jul 7, 2013, 9:22:14 PM7/7/13
to target-devel, Or Gerlitz, Mike Christie, Nicholas Bellinger
From: Nicholas Bellinger <n...@linux-iscsi.org>

This patch makes isert_disconnect_work() trigger rx/tx thread
pair connection reinstatement, which is required when discovery
sessions for iser don't send a logout request.

Cc: Or Gerlitz <oger...@mellanox.com>
Signed-off-by: Nicholas Bellinger <n...@linux-iscsi.org>
---
drivers/infiniband/ulp/isert/ib_isert.c | 3 +++
drivers/target/iscsi/iscsi_target_erl0.c | 1 +
include/target/iscsi/iscsi_transport.h | 4 ++++
3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 095695b..f02bfcc 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -559,6 +559,9 @@ isert_disconnect_work(struct work_struct *work)
pr_debug("Calling rdma_disconnect for !logout_posted from"
" isert_disconnect_work\n");
rdma_disconnect(isert_conn->conn_cm_id);
+ mutex_unlock(&isert_conn->conn_mutex);
+ iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
+ goto wake_up;
}
mutex_unlock(&isert_conn->conn_mutex);

diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c
index 8f074e0..3722f8d 100644
--- a/drivers/target/iscsi/iscsi_target_erl0.c
+++ b/drivers/target/iscsi/iscsi_target_erl0.c
@@ -908,6 +908,7 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep)
wait_for_completion(&conn->conn_wait_comp);
complete(&conn->conn_post_wait_comp);
}
+EXPORT_SYMBOL(iscsit_cause_connection_reinstatement);

void iscsit_fall_back_to_erl0(struct iscsi_session *sess)
{
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index ce4070d..e5d09d2 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -73,6 +73,10 @@ extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
*/
extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *);
/*
+ * From iscsi_target_erl0.c
+ */
+extern void iscsit_cause_connection_reinstatement(struct iscsi_conn *, int);
+/*
* From iscsi_target_erl1.c
*/
extern void iscsit_stop_dataout_timer(struct iscsi_cmd *);
--
1.7.2.5

Nicholas A. Bellinger

unread,
Jul 7, 2013, 9:22:15 PM7/7/13
to target-devel, Or Gerlitz, Mike Christie, Nicholas Bellinger
From: Nicholas Bellinger <n...@linux-iscsi.org>

This patch adds a check in isert_rx_opcode() to ignore non TEXT + LOGOUT
opcodes when SessionType=Discovery has been negotiated.

Cc: Or Gerlitz <oger...@mellanox.com>
Signed-off-by: Nicholas Bellinger <n...@linux-iscsi.org>
---
drivers/infiniband/ulp/isert/ib_isert.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index f02bfcc..ecd1654 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -1066,11 +1066,19 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc,
{
struct iscsi_hdr *hdr = &rx_desc->iscsi_header;
struct iscsi_conn *conn = isert_conn->conn;
+ struct iscsi_session *sess = conn->sess;
struct iscsi_cmd *cmd;
struct isert_cmd *isert_cmd;
int ret = -EINVAL;
u8 opcode = (hdr->opcode & ISCSI_OPCODE_MASK);

+ if (sess->sess_ops->SessionType &&
+ (!(opcode & ISCSI_OP_TEXT) || !(opcode & ISCSI_OP_LOGOUT))) {
+ pr_err("Got illegal opcode: 0x%02x in SessionType=Discovery,"
+ " ignoring\n", opcode);
+ return 0;
+ }
+
switch (opcode) {
case ISCSI_OP_SCSI_CMD:
cmd = iscsit_allocate_cmd(conn, GFP_KERNEL);
--
1.7.2.5

Reply all
Reply to author
Forward
0 new messages