mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
iscsi-target: Fix delayed logout processing greater than SECONDS_FOR_LOGOUT_COMP
commit 105fa2f44e upstream.
This patch fixes a BUG() in iscsit_close_session() that could be
triggered when iscsit_logout_post_handler() execution from within
tx thread context was not run for more than SECONDS_FOR_LOGOUT_COMP
(15 seconds), and the TCP connection didn't already close before
then forcing tx thread context to automatically exit.
This would manifest itself during explicit logout as:
[33206.974254] 1 connection(s) still exist for iSCSI session to iqn.1993-08.org.debian:01:3f5523242179
[33206.980184] INFO: NMI handler (kgdb_nmi_handler) took too long to run: 2100.772 msecs
[33209.078643] ------------[ cut here ]------------
[33209.078646] kernel BUG at drivers/target/iscsi/iscsi_target.c:4346!
Normally when explicit logout attempt fails, the tx thread context
exits and iscsit_close_connection() from rx thread context does the
extra cleanup once it detects conn->conn_logout_remove has not been
cleared by the logout type specific post handlers.
To address this special case, if the logout post handler in tx thread
context detects conn->tx_thread_active has already been cleared, simply
return and exit in order for existing iscsit_close_connection()
logic from rx thread context do failed logout cleanup.
Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Tested-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Tested-by: Gary Guo <ghg@datera.io>
Tested-by: Chu Yuan Lin <cyl@datera.io>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1f576d53d8
commit
463440e6de
@@ -4431,8 +4431,11 @@ static void iscsit_logout_post_handler_closesession(
|
|||||||
* always sleep waiting for RX/TX thread shutdown to complete
|
* always sleep waiting for RX/TX thread shutdown to complete
|
||||||
* within iscsit_close_connection().
|
* within iscsit_close_connection().
|
||||||
*/
|
*/
|
||||||
if (!conn->conn_transport->rdma_shutdown)
|
if (!conn->conn_transport->rdma_shutdown) {
|
||||||
sleep = cmpxchg(&conn->tx_thread_active, true, false);
|
sleep = cmpxchg(&conn->tx_thread_active, true, false);
|
||||||
|
if (!sleep)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
atomic_set(&conn->conn_logout_remove, 0);
|
atomic_set(&conn->conn_logout_remove, 0);
|
||||||
complete(&conn->conn_logout_comp);
|
complete(&conn->conn_logout_comp);
|
||||||
@@ -4448,8 +4451,11 @@ static void iscsit_logout_post_handler_samecid(
|
|||||||
{
|
{
|
||||||
int sleep = 1;
|
int sleep = 1;
|
||||||
|
|
||||||
if (!conn->conn_transport->rdma_shutdown)
|
if (!conn->conn_transport->rdma_shutdown) {
|
||||||
sleep = cmpxchg(&conn->tx_thread_active, true, false);
|
sleep = cmpxchg(&conn->tx_thread_active, true, false);
|
||||||
|
if (!sleep)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
atomic_set(&conn->conn_logout_remove, 0);
|
atomic_set(&conn->conn_logout_remove, 0);
|
||||||
complete(&conn->conn_logout_comp);
|
complete(&conn->conn_logout_comp);
|
||||||
|
|||||||
Reference in New Issue
Block a user