iscsi-scst: Serialize socket disconnect calls properly

This patch fixes the following kernel complaint:

WARNING: suspicious RCU usage
include/net/sock.h:1907 suspicious rcu_dereference_protected() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
no locks held by iscsi_conn_clea/18329.
stack backtrace:
Call Trace:
 dump_stack+0xa5/0xe6
 lockdep_rcu_suspicious+0x107/0x111
 tcp_disconnect+0x9ee/0xa60
 iscsi_tcp_conn_close+0x5d/0x90 [iscsi_scst]
 close_conn+0xcfe/0x1470 [iscsi_scst]
 close_conn_thr+0x54/0x80 [iscsi_scst]
 kthread+0x1bc/0x210
 ret_from_fork+0x24/0x30

Fixes: commit ba3062fe6b ("iscsi-scst: Improve connection shutdown time";
r297).


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8693 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-12-23 18:51:02 +00:00
parent 11ca9d6704
commit d85e33dbcc

View File

@@ -3464,10 +3464,15 @@ static int iscsi_tcp_send_locally(struct iscsi_cmnd *req,
static void iscsi_tcp_conn_close(struct iscsi_conn *conn, int flags)
{
if (!flags)
conn->sock->sk->sk_prot->disconnect(conn->sock->sk, 0);
else
struct sock *sk = conn->sock->sk;
if (!flags) {
lock_sock(sk);
sk->sk_prot->disconnect(sk, 0);
release_sock(sk);
} else {
conn->sock->ops->shutdown(conn->sock, flags);
}
}
static int iscsi_xmit_response(struct scst_cmd *scst_cmd)