Forgot to cc Janwar Dinata.

Mike Christie wrote:
> Simone Morellato wrote:
>> Hi,
>>
>> I saw this different behavior in open-iscsi version 2.0.870 compare with 
>> 2.0.865
>>
>> Open-iscsi version 2.0.870 doesn't reestablish connection after a logout 
>> request from the target.
>>
>> Anybody experience this problem?
>>
>> Is it the new behavior or is it a bug?
>>
> 
> Ok it looks like a problem caused but this patch:
> 
> 3be3994ae96e40a5a98bfc07450086693cc5cd65
> fix async logout time2wait handling and fix login error handling
> 
> 1. if the target sent us an async logout request, then when we
> get the logout response we must use the time2wait value in the logout
> response.
> 
> 2. we were skipping the login response parsing in initiator.c.
> If the target sent us a error that is retryable, we were just
> killing the session right away.
> 
> I think there are two bugs.
> 
> 1. we are using ntohl when converting and the field is only 16 bits.
> 
> 2. It looks like your target is giving us something like 36 hours (this 
> may be to #1) in the time2wait logout response and we are waiting that 
> long to relogin (do connection reinstatement) because we think this 
> counts as a implicit logout.
> 
>     If the Logout Response code is 0 and if the operational
>     ErrorRecoveryLevel is 2, this is the minimum amount of time, in
>     seconds, to wait before attempting task reassignment.  If the Logout
>     Response code is 0 and if the operational ErrorRecoveryLevel is less
>     than 2, this field is to be ignored.
> 
>     This field is invalid if the Logout Response code is 1.
> 
>     If the Logout response code is 2 or 3, this field specifies the
>     minimum time to wait before attempting a new implicit or explicit
>     logout.
> 
>     If Time2Wait is 0, the reassignment or a new Logout may be attempted
>     immediately.
> 
> After the logout we would try Connection Reinstatement (implicit 
> logout), and so that is why we were waiting time2wait before trying to 
> log back in. But right now we always use the tim2wait but we should be 
> checking the response code to see if it is 2 or 3.
> 
> So the attached patch should hopefully fix the issue.
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

--- open-iscsi-2.0-870.1/usr/initiator.c        2008-11-22 11:06:46.000000000 
-0600
+++ open-iscsi-2.0-870.1.work/usr/initiator.c   2008-12-02 13:19:21.000000000 
-0600
@@ -1538,12 +1538,13 @@ static void iscsi_recv_nop_in(iscsi_conn
 static void iscsi_recv_logout_rsp(iscsi_conn_t *conn, struct iscsi_hdr *hdr)
 {
        struct iscsi_logout_rsp *logout_rsp = (struct iscsi_logout_rsp *)hdr;
-       log_debug(3, "Recv: logout response\n");
 
-
-       conn->session->def_time2wait = ntohl(logout_rsp->t2wait);
-       log_debug(4, "logout rsp returned time2wait %u",
-                 conn->session->def_time2wait);
+       log_debug(3, "Recv: logout response %d\n", logout_rsp->response);
+       if (logout_rsp->response == 2 || logout_rsp->response == 3) {
+               conn->session->def_time2wait = ntohs(logout_rsp->t2wait);
+               log_debug(4, "logout rsp returned time2wait %u",
+                         conn->session->def_time2wait);
+       }
        /* TODO process the hdr */
        __conn_error_handle(conn->session, conn);
 }

Reply via email to