Skip to contentSkip to conversation

cxgbit: Abort the TCP connection in case of data out timeout

PATCH New Varun Prakash 1 participant 1 message Oct 4, 2017 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxgbit: Abort the TCP connection in case of data out timeout

If DDP is programmed for a WRITE cmd and data out timer gets expired then abort the TCP connection before freeing the cmd to avoid any possibility of DDP after freeing the cmd.

---
 drivers/target/iscsi/cxgbit/cxgbit.h     |  2 ++
 drivers/target/iscsi/cxgbit/cxgbit_cm.c  | 45 ++++++++++++++++++++++++++++++++
 drivers/target/iscsi/cxgbit/cxgbit_ddp.c |  8 ++++++
 3 files changed, 55 insertions(+)
drivers/target/iscsi/cxgbit/cxgbit.h +2 -0
index 9038869..417b9e6 100644
@@ -165,6 +165,7 @@ enum cxgbit_csk_flags {
 	CSK_LOGIN_PDU_DONE,
 	CSK_LOGIN_DONE,
 	CSK_DDP_ENABLE,
+	CSK_ABORT_RPL_WAIT,
 };
 
 struct cxgbit_sock_common {
@@ -321,6 +322,7 @@ int cxgbit_setup_np(struct iscsi_np *, struct sockaddr_storage *);
 int cxgbit_setup_conn_digest(struct cxgbit_sock *);
 int cxgbit_accept_np(struct iscsi_np *, struct iscsi_conn *);
 void cxgbit_free_np(struct iscsi_np *);
+void cxgbit_abort_conn(struct cxgbit_sock *csk);
 void cxgbit_free_conn(struct iscsi_conn *);
 extern cxgbit_cplhandler_func cxgbit_cplhandlers[NUM_CPL_CMDS];
 int cxgbit_get_login_rx(struct iscsi_conn *, struct iscsi_login *);
drivers/target/iscsi/cxgbit/cxgbit_cm.c +45 -0

63 lines not on this page · raw message

drivers/target/iscsi/cxgbit/cxgbit_ddp.c +7 -0
index 5fdb57c..768cce0 100644
@@ -275,6 +275,14 @@ void cxgbit_release_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd)
 			struct cxgbit_device *cdev = csk->com.cdev;
 			struct cxgbi_ppm *ppm = cdev2ppm(cdev);
 
+			/* Abort the TCP conn if DDP is not complete to
+			 * avoid any possibility of DDP after freeing
+			 * the cmd.
+			 */
+			if (unlikely(cmd->write_data_done !+				     cmd->se_cmd.data_length))
+				cxgbit_abort_conn(csk);
+
 			cxgbi_ppm_ppod_release(ppm, ttinfo->idx);
 
 			dma_unmap_sg(&ppm->pdev->dev, ttinfo->sgl,
Signature · 1 line
2.0.2