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

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/1c130ae00b769a2e2df41bad3d6051ee8234b636
Commit:     1c130ae00b769a2e2df41bad3d6051ee8234b636
Parent:     85fae482a9dd3560b9dcd35136fb29ccab6fae48
Refname:    refs/heads/master
Author:     Florian Westphal <[email protected]>
AuthorDate: Fri Jan 19 14:36:29 2018 +0100
Committer:  Nicholas Bellinger <[email protected]>
CommitDate: Tue Jan 23 23:03:54 2018 -0800

    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: Mike Christie <[email protected]>
    Bisected-by: Mike Christie <[email protected]>
    Tested-by: Mike Christie <[email protected]>
    Diagnosed-by: Nicholas Bellinger <[email protected]>
    Fixes: e7942d0633c4 ("tcp: remove prequeue support")
    Signed-off-by: Florian Westphal <[email protected]>
    Cc: [email protected] # 4.14+
    Signed-off-by: Nicholas Bellinger <[email protected]>
---
 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..8a5e8d17a942 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 (iscsi_target_sk_data_ready == conn->orig_data_ready)
+			return;
+		conn->orig_data_ready(sk);
 		return;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.