[PATCH] tgtd: let conn_close() transfer state of a connection

Hitoshi Mitake <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
Current tgtd seems to have a possibility that it has a connection
whose state isn't STATE_CLOSE even after the connection is passed to
conn_close(). Such a connection is confusing because
iscsi_scsi_cmd_done() cannot detect the closing of the connection.

This patch lets conn_close() transfer state of a connection to
STATE_CLOSE for avoiding this purpose.

Signed-off-by: Hitoshi Mitake <[email protected]>
---
 usr/iscsi/conn.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c
index bb18ac0..cfd6b3e 100644
--- a/usr/iscsi/conn.c
+++ b/usr/iscsi/conn.c
@@ -88,6 +88,8 @@ void conn_close(struct iscsi_connection *conn)
 	struct iscsi_task *task, *tmp;
 	int ret;
 
+	conn->state = STATE_CLOSE;
+
 	if (conn->closed) {
 		eprintf("already closed %p %u\n", conn, conn->refcount);
 		return;
-- 
1.7.10.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.