All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
To: open-iscsi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Cc: Chris Leech <cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] iscsi_tcp: consider session state in iscsi_sw_sk_state_check
Date: Wed, 24 Jul 2013 20:02:52 -0500	[thread overview]
Message-ID: <51F0793C.1090401@cs.wisc.edu> (raw)
In-Reply-To: <1374615728-11056-1-git-send-email-cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On 07/23/2013 04:42 PM, Chris Leech wrote:
> It seems some iSCSI targets (including the Linux kernel target) close
> the TCP connection from the target side immediately after processing a
> session logout.
> 
> When a TCP FIN comes in right after the iSCSI logout response,
> iscsi_sw_sk_state_check sees the local socket as not yet being in
> CLOSE_WAIT or CLOSE and logs an error.  But the initiator would close
> the connection right after processing the logout response anyway, and
> the error is confusing to admins who just requested that the session be
> shut down.
> 
> This adds a check of the session state, and suppresses the error if we
> are in the process of logging out.
> 
> Signed-off-by: Chris Leech <cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/scsi/iscsi_tcp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
> index 9e2588a..add6d15 100644
> --- a/drivers/scsi/iscsi_tcp.c
> +++ b/drivers/scsi/iscsi_tcp.c
> @@ -116,6 +116,7 @@ static inline int iscsi_sw_sk_state_check(struct sock *sk)
>  	struct iscsi_conn *conn = sk->sk_user_data;
>  
>  	if ((sk->sk_state == TCP_CLOSE_WAIT || sk->sk_state == TCP_CLOSE) &&
> +	    (conn->session->state != ISCSI_STATE_LOGGING_OUT) &&
>  	    !atomic_read(&sk->sk_rmem_alloc)) {
>  		ISCSI_SW_TCP_DBG(conn, "TCP_CLOSE|TCP_CLOSE_WAIT\n");
>  		iscsi_conn_failure(conn, ISCSI_ERR_TCP_CONN_CLOSE);
> 

My only concern with the patch is what happens if the target closes
connection due to a logout processing error. The logout timeout will
kick in so we do not hang, but the patch makes it harder to debug those
type of problems. I think the annoyance that this error message causes
is higher than those concerns though since that happens so rarely now.
So patch is ok with me.


Reviewed-by: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

-- 
You received this message because you are subscribed to the Google Groups "open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.

      parent reply	other threads:[~2013-07-25  1:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 21:42 [PATCH] iscsi_tcp: consider session state in iscsi_sw_sk_state_check Chris Leech
     [not found] ` <1374615728-11056-1-git-send-email-cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-07-25  1:02   ` Mike Christie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F0793C.1090401@cs.wisc.edu \
    --to=michaelc-hcno3ddehluvc3sceru5cw@public.gmane.org \
    --cc=cleech-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=open-iscsi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.