linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	Mike Christie <mchristi@redhat.com>,
	Hannes Reinecke <hare@suse.de>,
	Sagi Grimberg <sagig@mellanox.com>, Gary Guo <ghg@datera.io>,
	Chu Yuan Lin <cyl@datera.io>,
	Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [PATCH 4.4 16/58] iscsi-target: Fix delayed logout processing greater than SECONDS_FOR_LOGOUT_COMP
Date: Wed,  9 Aug 2017 12:41:28 -0700	[thread overview]
Message-ID: <20170809194147.155254059@linuxfoundation.org> (raw)
In-Reply-To: <20170809194146.501519882@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit 105fa2f44e504c830697b0c794822112d79808dc 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>


---
 drivers/target/iscsi/iscsi_target.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -4591,8 +4591,11 @@ static void iscsit_logout_post_handler_c
 	 * always sleep waiting for RX/TX thread shutdown to complete
 	 * within iscsit_close_connection().
 	 */
-	if (conn->conn_transport->transport_type == ISCSI_TCP)
+	if (conn->conn_transport->transport_type == ISCSI_TCP) {
 		sleep = cmpxchg(&conn->tx_thread_active, true, false);
+		if (!sleep)
+			return;
+	}
 
 	atomic_set(&conn->conn_logout_remove, 0);
 	complete(&conn->conn_logout_comp);
@@ -4608,8 +4611,11 @@ static void iscsit_logout_post_handler_s
 {
 	int sleep = 1;
 
-	if (conn->conn_transport->transport_type == ISCSI_TCP)
+	if (conn->conn_transport->transport_type == ISCSI_TCP) {
 		sleep = cmpxchg(&conn->tx_thread_active, true, false);
+		if (!sleep)
+			return;
+	}
 
 	atomic_set(&conn->conn_logout_remove, 0);
 	complete(&conn->conn_logout_comp);

  parent reply	other threads:[~2017-08-09 19:43 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 19:41 [PATCH 4.4 00/58] 4.4.81-stable review Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 01/58] parisc: Increase thread and stack size to 32kb Greg Kroah-Hartman
2017-08-11  1:33   ` Ben Hutchings
2017-08-11  7:21     ` Helge Deller
2017-08-11 15:33       ` Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 02/58] libata: array underflow in ata_find_dev() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 03/58] workqueue: restore WQ_UNBOUND/max_active==1 to be ordered Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 04/58] ALSA: hda - Fix speaker output from VAIO VPCL14M1R Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 05/58] ASoC: do not close shared backend dailink Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 07/58] mm/page_alloc: Remove kernel address exposure in free_reserved_area() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 08/58] ext4: fix SEEK_HOLE/SEEK_DATA for blocksize < pagesize Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 09/58] ext4: fix overflow caused by missing cast in ext4_resize_fs() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 10/58] ARM: dts: armada-38x: Fix irq type for pca955 Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 11/58] media: platform: davinci: return -EINVAL for VPFE_CMD_S_CCDC_RAW_PARAMS ioctl Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 12/58] target: Avoid mappedlun symlink creation during lun shutdown Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 13/58] iscsi-target: Always wait for kthread_should_stop() before kthread exit Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 14/58] iscsi-target: Fix early sk_data_ready LOGIN_FLAGS_READY race Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 15/58] iscsi-target: Fix initial login PDU asynchronous socket close OOPs Greg Kroah-Hartman
2017-08-11 16:12   ` Ben Hutchings
2017-08-09 19:41 ` Greg Kroah-Hartman [this message]
2017-08-09 19:41 ` [PATCH 4.4 17/58] iser-target: Avoid isert_conn->cm_id dereference in isert_login_recv_done Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 18/58] mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries Greg Kroah-Hartman
2017-08-11 17:45   ` Ben Hutchings
2017-08-13  6:27     ` Nadav Amit
2017-08-15 13:36       ` Ben Hutchings
2017-08-15 16:39         ` Nadav Amit
2017-08-14  8:00     ` Mel Gorman
2017-08-09 19:41 ` [PATCH 4.4 19/58] media: lirc: LIRC_GET_REC_RESOLUTION should return microseconds Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 20/58] f2fs: sanity check checkpoint segno and blkoff Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 21/58] drm: rcar-du: fix backport bug Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 22/58] [media] saa7164: fix double fetch PCIe access condition Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 23/58] ipv4: ipv6: initialize treq->txhash in cookie_v[46]_check() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 24/58] net: Zero terminate ifr_name in dev_ifname() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 25/58] ipv6: avoid overflow of offset in ip6_find_1stfragopt Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 26/58] ipv4: initialize fib_trie prior to register_netdev_notifier call Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 27/58] rtnetlink: allocate more memory for dev_set_mac_address() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 28/58] mcs7780: Fix initialization when CONFIG_VMAP_STACK is enabled Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 29/58] openvswitch: fix potential out of bound access in parse_ct Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 30/58] packet: fix use-after-free in prb_retire_rx_blk_timer_expired() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 31/58] ipv6: Dont increase IPSTATS_MIB_FRAGFAILS twice in ip6_fragment() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 32/58] net: ethernet: nb8800: Handle all 4 RGMII modes identically Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 33/58] dccp: fix a memleak that dccp_ipv6 doesnt put reqsk properly Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 34/58] dccp: fix a memleak that dccp_ipv4 " Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 35/58] dccp: fix a memleak for dccp_feat_init err process Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 36/58] sctp: dont dereference ptr before leaving _sctp_walk_{params, errors}() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 37/58] sctp: fix the check for _sctp_walk_params and _sctp_walk_errors Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 38/58] net/mlx5: Fix command bad flow on command entry allocation failure Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 39/58] net: phy: Correctly process PHY_HALTED in phy_stop_machine() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 40/58] xen-netback: correctly schedule rate-limited queues Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 41/58] sparc64: Measure receiver forward progress to avoid send mondo timeout Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 42/58] sparc64: Prevent perf from running during super critical sections Greg Kroah-Hartman
2017-08-10 16:20   ` Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 43/58] wext: handle NULL extra data in iwe_stream_add_point better Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 44/58] sh_eth: R8A7740 supports packet shecksumming Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 45/58] net: phy: dp83867: fix irq generation Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 46/58] tg3: Fix race condition in tg3_get_stats64() Greg Kroah-Hartman
2017-08-09 19:41 ` [PATCH 4.4 47/58] x86/boot: Add missing declaration of string functions Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 48/58] phy state machine: failsafe leave invalid RUNNING state Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 49/58] scsi: qla2xxx: Get mutex lock before checking optrom_state Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 50/58] drm/virtio: fix framebuffer sparse warning Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 51/58] virtio_blk: fix panic in initialization error path Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 52/58] ARM: 8632/1: ftrace: fix syscall name matching Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 53/58] mm, slab: make sure that KMALLOC_MAX_SIZE will fit into MAX_ORDER Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 54/58] lib/Kconfig.debug: fix frv build failure Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 55/58] signal: protect SIGNAL_UNKILLABLE from unintentional clearing Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 56/58] mm: dont dereference struct page fields of invalid pages Greg Kroah-Hartman
2017-08-09 19:42 ` [PATCH 4.4 57/58] ipv4: Should use consistent conditional judgement for ip fragment in __ip_append_data and ip_finish_output Greg Kroah-Hartman
2017-08-10  0:02 ` [PATCH 4.4 00/58] 4.4.81-stable review Shuah Khan
2017-08-10  0:37 ` Guenter Roeck
2017-08-10 16:17   ` Greg Kroah-Hartman
2017-08-10 17:34     ` Guenter Roeck
2017-08-10 16:21   ` Greg Kroah-Hartman
2017-08-10  0:58 ` Guenter Roeck
2017-08-10 16:18   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170809194147.155254059@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bart.vanassche@sandisk.com \
    --cc=cyl@datera.io \
    --cc=ghg@datera.io \
    --cc=hare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=sagig@mellanox.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).