iscsi-target: Fix iser explicit logout TX kthread leak
authorNicholas Bellinger <nab@linux-iscsi.org>
Thu, 23 Jul 2015 22:30:31 +0000 (22:30 +0000)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:09:39 +0000 (13:09 +0000)
commit0e5c84deb463c2fdbd3a586ac24bd470b0583e2d
tree2f40b2a4e10fea4c14db5ed9336901c891b94562
parent5319d0b176ecb5b225f14cc64da196542679bf07
iscsi-target: Fix iser explicit logout TX kthread leak

commit 007d038bdf95ccfe2491d0078be54040d110fd06 upstream.

This patch fixes a regression introduced with the following commit
in v4.0-rc1 code, where an explicit iser-target logout would result
in ->tx_thread_active being incorrectly cleared by the logout post
handler, and subsequent TX kthread leak:

    commit 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca
    Author: Nicholas Bellinger <nab@linux-iscsi.org>
    Date:   Thu Feb 26 22:19:15 2015 -0800

        iscsi-target: Convert iscsi_thread_set usage to kthread.h

To address this bug, change iscsit_logout_post_handler_closesession()
and iscsit_logout_post_handler_samecid() to only cmpxchg() on
->tx_thread_active for traditional iscsi/tcp connections.

This is required because iscsi/tcp connections are invoking logout
post handler logic directly from TX kthread context, while iser
connections are invoking logout post handler logic from a seperate
workqueue context.

Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/iscsi/iscsi_target.c