From a8b24ae319b106c2fb9d671a712627334f368ba0 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 21 Apr 2017 01:36:34 +0000 Subject: [PATCH] iscsi_scst: conn_lookup() skips any conn already closing This change helped a secondary problem I had under valgrind (due to some other bug) with initiators timing out and reconnecting their sessions faster than the threads were getting cleaned up (for one thing, valgrind only ever runs one thread at a time). It seems logical that the code in conn_lookup() would want to skip any connection that's already known closing in this case, for the same reason it searches the list in reverse. And the dropping connections don't have to drop in order, so searching in reverse doesn't seem sufficient to avoid finding a wrong (stale, closing) connection structure. Signed-off-by: David Butterfield git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7144 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index e713a1e43..572d6c440 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -397,7 +397,7 @@ struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid) */ list_for_each_entry_reverse(conn, &session->conn_list, conn_list_entry) { - if (conn->cid == cid) + if (conn->cid == cid && !conn->closing) return conn; } return NULL;