[Stgt-devel] Open connections

FUJITA Tomonori fujita.tomonori
Sat Mar 29 19:17:00 CET 2008


On Thu, 27 Mar 2008 21:56:11 +0100 (CET)
"Niels de Carpentier" <stgt at decarpentier.com> wrote:

> >> On Wed, 19 Mar 2008 03:53:36 +0100 (CET)
> >> "Niels de Carpentier" <stgt at decarpentier.com> wrote:
> >>
> >>> The issue where a connection isn't properly closed because
> >>> it_nexus_destroy returns EBUSY.
> >>>
> >>> This probably isn't very important anymore, as the reconnect should now
> >>> close the old connection properly.
> >>
> >> We hit that issue since tgt doesn't implement session reinstatement
> >> properly, I think.
> >>
> >> You still hit that issue with the patch?
> >>
> > Yes, that issue is still there. (And it actually happens before the
> > session reinstatement).
> >
> 
> Some debug information about the close issue:
> 
> tgtd: iscsi_tcp_event_handler(160) connection closed
> tgtd: conn_close(88) connection closed
> tgtd: conn_close(111) Forcing release of tx task 34
> tgtd: conn_close(111) Forcing release of tx task 2f
> tgtd: conn_close(111) Forcing release of tx task 4e
> tgtd: conn_close(111) Forcing release of tx task 66
> tgtd: conn_close(111) Forcing release of tx task 39
> tgtd: conn_close(111) Forcing release of tx task 6a
> tgtd: conn_close(111) Forcing release of tx task 28
> tgtd: conn_close(111) Forcing release of tx task 40
> tgtd: conn_close(111) Forcing release of tx task 3d
> tgtd: conn_close(111) Forcing release of tx task 37
> tgtd: conn_close(111) Forcing release of tx task 2a
> tgtd: conn_close(111) Forcing release of tx task 4c
> tgtd: conn_close(111) Forcing release of tx task 6c
> tgtd: conn_close(111) Forcing release of tx task 4a
> tgtd: conn_close(111) Forcing release of tx task 49
> tgtd: conn_close(111) Forcing release of tx task 48
> tgtd: conn_close(111) Forcing release of tx task 41
> tgtd: conn_close(111) Forcing release of tx task 54
> tgtd: conn_close(111) Forcing release of tx task 38
> tgtd: conn_close(111) Forcing release of tx task 4f
> tgtd: conn_close(111) Forcing release of tx task 15
> tgtd: conn_close(111) Forcing release of tx task 20
> tgtd: it_nexus_destroy(257) 1 1
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 0 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 1 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 2 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 3 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 7 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 8 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 9 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 11 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 12 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 13 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 14 not empty
> tgtd: it_nexus_destroy(265) cmd_hash_list entry 15 not empty
> tgtd: iscsi_tcp_event_handler(167) connection closed
> 
> So it looks like the cmd_hash_list is not actually cleared on a connection
> close.
> 
> Is there anything more I can do to troubleshoot this issue?

Can you try this patch?

Thanks,

diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c
index 0262729..25ad170 100644
--- a/usr/iscsi/conn.c
+++ b/usr/iscsi/conn.c
@@ -109,8 +109,7 @@ void conn_close(struct iscsi_connection *conn)
 	list_for_each_entry_safe(task, tmp, &conn->tx_clist, c_list) {
 		dprintf("Forcing release of tx task %" PRIx64 "\n",
 			task->tag);
-		list_del(&task->c_list);
-		iscsi_free_task(task);
+		iscsi_free_cmd_task(task);
 	}
 
 	if (conn->rx_task) {
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index bc8a1d5..fb140e8 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1076,7 +1076,7 @@ static inline struct iscsi_task *ITASK(struct scsi_cmd *scmd)
 	return container_of(scmd, struct iscsi_task, scmd);
 }
 
-static void iscsi_free_cmd_task(struct iscsi_task *task)
+void iscsi_free_cmd_task(struct iscsi_task *task)
 {
 	target_cmd_done(&task->scmd);
 
diff --git a/usr/iscsi/iscsid.h b/usr/iscsi/iscsid.h
index 7d67727..56b0900 100644
--- a/usr/iscsi/iscsid.h
+++ b/usr/iscsi/iscsid.h
@@ -267,6 +267,7 @@ extern int iscsi_scsi_cmd_execute(struct iscsi_task *task);
 
 /* iscsid.c iscsi_task */
 extern void iscsi_free_task(struct iscsi_task *task);
+extern void iscsi_free_cmd_task(struct iscsi_task *task);
 
 /* session.c */
 extern struct iscsi_session *session_find_name(int tid, const char *iname, uint8_t *isid);




More information about the stgt mailing list