[Stgt-devel] Open connections

Niels de Carpentier stgt
Wed Mar 19 03:06:57 CET 2008


>>
>> The reconnect issue seems to be related to some commented out code in
>> login_security_done:
>>
>>                 if (!req->tsih) {
>>                         /* do session reinstatement */
>>                         /* We need to close all connections in this
>> session */
>> /*                      session_conns_close(conn->tid, sid); */
>> /*                      session = NULL; */
>>
>> If I uncomment the session = NULL, things will work ok. (Of course this
>> doesn't handle any cleanups, but indicates where the problem is)
>
> Yeah, one of the problems is that tgt doesn't implement session
> reinstatement properly.
>
> Can you try the following patch?

The patch fixed the reconnect issue for me, and properly closes the old
connection.

Just let me know if you need more info about the other issue. (I'll be on
leave till Monday, but will be available again after that.)

Niels

>
> Thanks,
>
> diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
> index 490a743..bc8a1d5 100644
> --- a/usr/iscsi/iscsid.c
> +++ b/usr/iscsi/iscsid.c
> @@ -237,10 +237,16 @@ static void login_security_done(struct
> iscsi_connection *conn)
>  	session = session_find_name(conn->tid, conn->initiator, req->isid);
>  	if (session) {
>  		if (!req->tsih) {
> +			struct iscsi_connection *ent, *next;
> +
>  			/* do session reinstatement */
> -			/* We need to close all connections in this session */
> -/* 			session_conns_close(conn->tid, sid); */
> -/* 			session = NULL; */
> +
> +			list_for_each_entry_safe(ent, next, &session->conn_list,
> +						 clist) {
> +				conn_close(ent);
> +			}
> +
> +			session = NULL;
>  		} else if (req->tsih != session->tsih) {
>  			/* fail the login */
>  			rsp->status_class = ISCSI_STATUS_CLS_INITIATOR_ERR;
> @@ -250,8 +256,10 @@ static void login_security_done(struct
> iscsi_connection *conn)
>  		} else if (conn_find(session, conn->cid)) {
>  			/* do connection reinstatement */
>  		}
> +
>  		/* add a new connection to the session */
> -		conn_add_to_session(conn, session);
> +		if (session)
> +			conn_add_to_session(conn, session);
>  	} else {
>  		if (req->tsih) {
>  			/* fail the login */
>





More information about the stgt mailing list