[stgt] [BUG] Tgt-1.0.8 exited unexpectedly

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Tue Oct 19 02:47:23 CEST 2010


On Sat, 18 Sep 2010 18:39:22 +0900 (JST)
Hirokazu Takahashi <taka at valinux.co.jp> wrote:

> Tgt-1.0.8 sometimes exited unexpectedly with an error in function
> iscsi_tx_handler leaving a message "tgtd: iscsi_tx_handler(2215)
> error 0 0." To figure out what happened, I tried running tgt-1.0.8

I found one bug related with tmf. There might be more but can you try
the following patch against the latest git (not against the ptread
branch).

Please report the result with a log like tgtd-Sep18th.log. The patch
gives more debug messages so I might get more ideas about the
problems.

Thanks!


diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c
index ba7a58f..900ea80 100644
--- a/usr/iscsi/conn.c
+++ b/usr/iscsi/conn.c
@@ -103,7 +103,8 @@ void conn_close(struct iscsi_connection *conn)
 	if (!conn->session)
 		goto done;
 
-	eprintf("sesson %p %d\n", conn->session, conn->session->refcount);
+	eprintf("sesson %p %d, %p\n", conn->session, conn->session->refcount,
+		conn);
 
 	/*
 	 * We just closed the ep so we are not going to send/recv anything.
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 3a79d93..404c5e8 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1346,6 +1346,12 @@ static int iscsi_tm_done(struct mgmt_req *mreq)
 
 	task = (struct iscsi_task *) (unsigned long) mreq->mid;
 
+	if (task->conn->state == STATE_CLOSE) {
+		list_del(&task->c_hlist);
+		iscsi_free_task(task);
+		return 0;
+	}
+
 	switch (mreq->result) {
 	case 0:
 		task->result = ISCSI_TMF_RSP_COMPLETE;
@@ -1407,6 +1413,7 @@ static int iscsi_tm_execute(struct iscsi_task *task)
 		task->result = err;
 	else {
 		int ret;
+		eprintf("%p %x\n", conn, fn);
 		ret = target_mgmt_request(conn->session->target->tid,
 					  conn->session->tsih,
 					  (unsigned long)task, fn, req->lun,
diff --git a/usr/target.c b/usr/target.c
index 79798ad..368557b 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -1081,6 +1081,10 @@ void target_cmd_done(struct scsi_cmd *cmd)
 	struct mgmt_req *mreq;
 
 	mreq = cmd->mreq;
+	if (mreq)
+		eprintf("%p %d %" PRIx64 " %lx\n", mreq, mreq->busy,
+			cmd->tag, cmd->state);
+
 	if (mreq && !--mreq->busy) {
 		mreq->result = mreq->function == ABORT_TASK ? -EEXIST : 0;
 		mreq->itn_id = cmd->cmd_itn_id;
@@ -1096,7 +1100,7 @@ static int abort_cmd(struct target* target, struct mgmt_req *mreq,
 {
 	int err = 0;
 
-	eprintf("found %" PRIx64 " %lx\n", cmd->tag, cmd->state);
+	eprintf("found %p %" PRIx64 " %lx\n", mreq, cmd->tag, cmd->state);
 
 	if (cmd_processed(cmd)) {
 		/*

--
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