Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c130ae0 authored by Florian Westphal's avatar Florian Westphal Committed by Nicholas Bellinger
Browse files

iscsi-target: make sure to wake up sleeping login worker



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.

(Drop WARN_ON usage - nab)

Reported-by: default avatarMike Christie <mchristi@redhat.com>
Bisected-by: default avatarMike Christie <mchristi@redhat.com>
Tested-by: default avatarMike Christie <mchristi@redhat.com>
Diagnosed-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Fixes: e7942d06 ("tcp: remove prequeue support")
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Cc: stable@vger.kernel.org # 4.14+
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 85fae482
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -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)) {
	if (test_and_set_bit(LOGIN_FLAGS_READ_ACTIVE, &conn->login_flags)) {
		write_unlock_bh(&sk->sk_callback_lock);
		write_unlock_bh(&sk->sk_callback_lock);
		pr_debug("Got LOGIN_FLAGS_READ_ACTIVE=1, conn: %p >>>>\n", conn);
		pr_debug("Got LOGIN_FLAGS_READ_ACTIVE=1, conn: %p >>>>\n", conn);
		if (iscsi_target_sk_data_ready == conn->orig_data_ready)
			return;
		conn->orig_data_ready(sk);
		return;
		return;
	}
	}