Skip to contentSkip to conversation

iscsi-target/iser-target: Fix breakage

PATCH New Nicholas A. Bellinger 1 participant 4 messages Apr 25, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover iscsi-target/iser-target: Fix breakage

From: Nicholas Bellinger <[email protected]>

Hi folks,

This series addresses two bugs within v3.10 for-next code related to the upcoming iscsi-target series adding multi-transport support, along with a third iser-target bugfix related to early ISCSI_OP_SCSI_CMD exception handling.

These three patches are being folded into for-next/for-next-merge code now..

Thanks!

--nab

Nicholas Bellinger (3):
iscsi-target: Fix solicited NopIN handling with RDMAExtentions=No
iscsi-target: Fix iscsit_handle_scsi_cmd() exception se_cmd leak
iser-target: Add special case for early ISCSI_OP_SCSI_CMD exception
handling

 drivers/infiniband/ulp/isert/ib_isert.c |    7 ++++++
 drivers/target/iscsi/iscsi_target.c     |   32 ++++++++++++++++++------------
 2 files changed, 26 insertions(+), 13 deletions(-)
Signature · 6 lines
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH 1/3 iscsi-target: Fix solicited NopIN handling with RDMAExtentions=No

From: Nicholas Bellinger <[email protected]>

This patches fixes a regression with solicited NopIN handling in traditional iSCSI code introduced during TX immediate queue refactoring for v3.10 for-next code.

---
 drivers/target/iscsi/iscsi_target.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/target/iscsi/iscsi_target.c +0 -6
index 0148cc3..5eee9b7 100644
@@ -3762,12 +3762,6 @@ check_rsp_state:
 		break;
 	case ISTATE_SEND_NOPIN:
 		ret = iscsit_send_nopin(cmd, conn);
-		if (!ret) {
-			spin_lock_bh(&cmd->istate_lock);
-			cmd->i_state = ISTATE_SENT_STATUS;
-			spin_unlock_bh(&cmd->istate_lock);
-			return 0;
-		}
 		break;
 	case ISTATE_SEND_REJECT:
 		ret = iscsit_send_reject(cmd, conn);
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/3 iscsi-target: Fix iscsit_handle_scsi_cmd() exception se_cmd leak

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

This patch fixes a regression where failures before backend se_cmd execution in iscsit_handle_scsi_cmd() is leaking iscsi_cmd due to a missing target_put_sess_cmd() call to drop the extra kref.

Introduced during the RX PDU refactoring in v3.10 for-next code.

---
 drivers/target/iscsi/iscsi_target.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)
drivers/target/iscsi/iscsi_target.c +19 -7
index 5eee9b7..ffbc6a9 100644
@@ -1069,12 +1069,17 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	 */
 	if (!cmd->immediate_data) {
 		cmdsn_ret = iscsit_sequence_cmd(conn, cmd, hdr->cmdsn);
-		if (cmdsn_ret == CMDSN_LOWER_THAN_EXP)
+		if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) {
+			if (!cmd->sense_reason)
+				return 0;
+
+			target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd);
 			return 0;
-		else if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER)
+		} else if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) {
 			return iscsit_add_reject_from_cmd(
 				ISCSI_REASON_PROTOCOL_ERROR,
 				1, 0, (unsigned char *)hdr, cmd);
+		}
 	}
 
 	iscsit_ack_from_expstatsn(conn, be32_to_cpu(hdr->exp_statsn));
@@ -1085,24 +1090,31 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	if (!cmd->immediate_data) {
 		if (!cmd->sense_reason && cmd->unsolicited_data)
 			iscsit_set_unsoliticed_dataout(cmd);
+		if (!cmd->sense_reason)
+			return 0;
 
+		target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd);
 		return 0;
 	}
 
 	/*
-	 * Early CHECK_CONDITIONs never make it to the transport processing
-	 * thread.  They are processed in CmdSN order by
-	 * iscsit_check_received_cmdsn() below.
+	 * Early CHECK_CONDITIONs with ImmediateData never make it to command
+	 * execution.  These exceptions are processed in CmdSN order using
+	 * iscsit_check_received_cmdsn() in iscsit_get_immediate_data() below.
 	 */
-	if (cmd->sense_reason)
+	if (cmd->sense_reason) {
+		target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd);
 		return 1;
+	}
 	/*
 	 * Call directly into transport_generic_new_cmd() to perform
 	 * the backend memory allocation.
 	 */
 	cmd->sense_reason = transport_generic_new_cmd(&cmd->se_cmd);
-	if (cmd->sense_reason)
+	if (cmd->sense_reason) {
+		target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd);
 		return 1;
+	}
 
 	return 0;
 }
Signature · 1 line
1.7.2.5
#3 lore raw

PATCH 3/3 iser-target: Add special case for early ISCSI_OP_SCSI_CMD exception handling

In reply to Nicholas A. Bellinger

From: Nicholas Bellinger <[email protected]>

During early ISCSI_OP_SCSI_CMD exception handling with non GOOD status, the TX thread context in isert_response_queue() needs to post IB_WR_SEND via isert_put_response() when processing ISTATE_SEND_STATUS.

---
 drivers/infiniband/ulp/isert/ib_isert.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +7 -0
index 1a150ef..41712f0 100644
@@ -1947,6 +1947,13 @@ isert_response_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state)
 	case ISTATE_SEND_REJECT:
 		ret = isert_put_reject(cmd, conn);
 		break;
+	case ISTATE_SEND_STATUS:
+		/*
+		 * Special case for sending non GOOD SCSI status from TX thread
+		 * context during pre se_cmd excecution failure.
+		 */
+		ret = isert_put_response(conn, cmd);
+		break;
 	default:
 		pr_err("Unknown response state: 0x%02x\n", state);
 		ret = -EINVAL;
Signature · 1 line
1.7.2.5