All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Florian Westphal <fw@strlen.de>, target-devel@vger.kernel.org
Cc: mchristi@redhat.com, nab@linux-iscsi.org, netdev@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH target-pending] iscsi-target: make sure to wake up sleeping login worker
Date: Fri, 19 Jan 2018 07:46:25 -0800	[thread overview]
Message-ID: <1516376785.3606.37.camel@gmail.com> (raw)
In-Reply-To: <20180119133629.14812-1-fw@strlen.de>

On Fri, 2018-01-19 at 14:36 +0100, Florian Westphal wrote:
> Mike Christie reports:
>   Starting in 4.14 iscsi logins will fail around 50% of the time.
> 
> Problem appears to be that iscsi_target_sk_data_ready() callback may
> return without doing anything in case it finds the login work queue
> is still blocked in sock_recvmsg().
> 
> Nicholas Bellinger says:
>   It would indicate users providing their own ->sk_data_ready() callback
>   must be responsible for waking up a kthread context blocked on
>   sock_recvmsg(..., MSG_WAITALL), when a second ->sk_data_ready() is
>   received before the first sock_recvmsg(..., MSG_WAITALL) completes.
> 
> So, do this and invoke the original data_ready() callback -- in
> case of tcp sockets this takes care of waking the thread.
> 
> Disclaimer: I do not understand why this problem did not show up before
> tcp prequeue removal.
> 
> Reported-by: Mike Christie <mchristi@redhat.com>
> Bisected-by: Mike Christie <mchristi@redhat.com>
> Tested-by: Mike Christie <mchristi@redhat.com>
> Diagnosed-by: Nicholas Bellinger <nab@linux-iscsi.org>
> Fixes: e7942d0633c4 ("tcp: remove prequeue support")
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  drivers/target/iscsi/iscsi_target_nego.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
> index b686e2ce9c0e..3723f8f419aa 100644
> --- a/drivers/target/iscsi/iscsi_target_nego.c
> +++ b/drivers/target/iscsi/iscsi_target_nego.c
> @@ -432,6 +432,9 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
>  	if (test_and_set_bit(LOGIN_FLAGS_READ_ACTIVE, &conn->login_flags)) {
>  		write_unlock_bh(&sk->sk_callback_lock);
>  		pr_debug("Got LOGIN_FLAGS_READ_ACTIVE=1, conn: %p >>>>\n", conn);
> +		if (WARN_ON(iscsi_target_sk_data_ready == conn->orig_data_ready))
> +			return;

Is this WARN_ON() belonging to this fix ?
At least make it WARN_ON_ONCE() or pr_err_once()

> +		conn->orig_data_ready(sk);
>  		return;
>  	}
>  

WARNING: multiple messages have this Message-ID (diff)
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Florian Westphal <fw@strlen.de>, target-devel@vger.kernel.org
Cc: mchristi@redhat.com, nab@linux-iscsi.org, netdev@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH target-pending] iscsi-target: make sure to wake up sleeping login worker
Date: Fri, 19 Jan 2018 15:46:25 +0000	[thread overview]
Message-ID: <1516376785.3606.37.camel@gmail.com> (raw)
In-Reply-To: <20180119133629.14812-1-fw@strlen.de>

On Fri, 2018-01-19 at 14:36 +0100, Florian Westphal wrote:
> Mike Christie reports:
>   Starting in 4.14 iscsi logins will fail around 50% of the time.
> 
> Problem appears to be that iscsi_target_sk_data_ready() callback may
> return without doing anything in case it finds the login work queue
> is still blocked in sock_recvmsg().
> 
> Nicholas Bellinger says:
>   It would indicate users providing their own ->sk_data_ready() callback
>   must be responsible for waking up a kthread context blocked on
>   sock_recvmsg(..., MSG_WAITALL), when a second ->sk_data_ready() is
>   received before the first sock_recvmsg(..., MSG_WAITALL) completes.
> 
> So, do this and invoke the original data_ready() callback -- in
> case of tcp sockets this takes care of waking the thread.
> 
> Disclaimer: I do not understand why this problem did not show up before
> tcp prequeue removal.
> 
> Reported-by: Mike Christie <mchristi@redhat.com>
> Bisected-by: Mike Christie <mchristi@redhat.com>
> Tested-by: Mike Christie <mchristi@redhat.com>
> Diagnosed-by: Nicholas Bellinger <nab@linux-iscsi.org>
> Fixes: e7942d0633c4 ("tcp: remove prequeue support")
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  drivers/target/iscsi/iscsi_target_nego.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
> index b686e2ce9c0e..3723f8f419aa 100644
> --- a/drivers/target/iscsi/iscsi_target_nego.c
> +++ b/drivers/target/iscsi/iscsi_target_nego.c
> @@ -432,6 +432,9 @@ static void iscsi_target_sk_data_ready(struct sock *sk)
>  	if (test_and_set_bit(LOGIN_FLAGS_READ_ACTIVE, &conn->login_flags)) {
>  		write_unlock_bh(&sk->sk_callback_lock);
>  		pr_debug("Got LOGIN_FLAGS_READ_ACTIVE=1, conn: %p >>>>\n", conn);
> +		if (WARN_ON(iscsi_target_sk_data_ready = conn->orig_data_ready))
> +			return;

Is this WARN_ON() belonging to this fix ?
At least make it WARN_ON_ONCE() or pr_err_once()

> +		conn->orig_data_ready(sk);
>  		return;
>  	}
>  

  reply	other threads:[~2018-01-19 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 13:36 [PATCH target-pending] iscsi-target: make sure to wake up sleeping login worker Florian Westphal
2018-01-19 13:36 ` Florian Westphal
2018-01-19 15:46 ` Eric Dumazet [this message]
2018-01-19 15:46   ` Eric Dumazet
2018-01-19 17:26   ` Florian Westphal
2018-01-19 17:26     ` Florian Westphal
2018-01-24  7:01     ` Nicholas A. Bellinger
2018-01-24  7:01       ` Nicholas A. Bellinger

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=1516376785.3606.37.camel@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=netdev@vger.kernel.org \
    --cc=target-devel@vger.kernel.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.