[stgt] [PATCH 03/15] Fix commit "iscsi: handle commands waiting for I/O completion properly"

Arne Redlich arne.redlich at googlemail.com
Tue Jun 9 18:21:59 CEST 2009


If sending the iSCSI task to the TGT core fails, the task is leaked.

Signed-off-by: Arne Redlich <arne.redlich at googlemail.com>
---
 usr/iscsi/iscsid.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 41e34de..bfc41eb 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1162,6 +1162,7 @@ static int iscsi_target_cmd_queue(struct iscsi_task *task)
 	uint32_t data_len;
 	uint8_t *ahs;
 	int ahslen;
+	int err;
 	enum data_direction dir = scsi_get_data_dir(scmd);
 
 	scmd->cmd_itn_id = conn->session->tsih;
@@ -1238,7 +1239,11 @@ static int iscsi_target_cmd_queue(struct iscsi_task *task)
 	scmd->tag = req->itt;
 	set_task_in_scsi(task);
 
-	return target_cmd_queue(conn->session->target->tid, scmd);
+	err = target_cmd_queue(conn->session->target->tid, scmd);
+	if (err)
+		clear_task_in_scsi(task);
+
+	return err;
 }
 
 int iscsi_scsi_cmd_execute(struct iscsi_task *task)
-- 
1.6.0.4



--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list