linux/drivers/target
Nicholas Bellinger 064cdd2d91 target: Fix race between iscsi-target connection shutdown + ABORT_TASK
This patch fixes a race in iscsit_release_commands_from_conn() ->
iscsit_free_cmd() -> transport_generic_free_cmd() + wait_for_tasks=1,
where CMD_T_FABRIC_STOP could end up being set after the final
kref_put() is called from core_tmr_abort_task() context.

This results in transport_generic_free_cmd() blocking indefinately
on se_cmd->cmd_wait_comp, because the target_release_cmd_kref()
check for CMD_T_FABRIC_STOP returns false.

To address this bug, make iscsit_release_commands_from_conn()
do list_splice and set CMD_T_FABRIC_STOP early while holding
iscsi_conn->cmd_lock.  Also make iscsit_aborted_task() only
remove iscsi_cmd_t if CMD_T_FABRIC_STOP has not already been
set.

Finally in target_release_cmd_kref(), only honor fabric_stop
if CMD_T_ABORTED has been set.

Cc: Mike Christie <mchristi@redhat.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Himanshu Madhani <himanshu.madhani@qlogic.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: stable@vger.kernel.org # 3.14+
Tested-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2016-07-20 00:58:34 -07:00
..
iscsi target: Fix race between iscsi-target connection shutdown + ABORT_TASK 2016-07-20 00:58:34 -07:00
loopback target: make close_session optional 2016-05-10 01:19:26 -07:00
sbp target: make close_session optional 2016-05-10 01:19:26 -07:00
tcm_fc target: make ->shutdown_session optional 2016-05-10 01:19:18 -07:00
Kconfig target: Put TCMU under a new config option 2015-04-19 22:41:12 -07:00
Makefile target: Put TCMU under a new config option 2015-04-19 22:41:12 -07:00
target_core_alua.c target: use new "dbroot" target attribute 2016-05-09 23:06:20 -07:00
target_core_alua.h target: Subsume se_port + t10_alua_tg_pt_gp_member into se_lun 2015-06-01 00:26:38 -07:00
target_core_configfs.c target: make close_session optional 2016-05-10 01:19:26 -07:00
target_core_device.c target: Remove enum transport_lunflags_table 2016-03-10 21:48:55 -08:00
target_core_fabric_configfs.c target: add a new add_wwn_groups fabrics method 2016-03-30 20:06:44 -07:00
target_core_fabric_lib.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-07-04 14:13:43 -07:00
target_core_file.c target: Fix WRITE_SAME/DISCARD conversion to linux 512b sectors 2016-01-29 19:29:34 -08:00
target_core_file.h target/file: Remove fd_prot bounce buffer 2015-05-30 22:41:42 -07:00
target_core_hba.c target: Fix target_sense_desc_format NULL pointer dereference 2015-09-24 23:17:23 -07:00
target_core_iblock.c block: kill off q->flush_flags 2016-04-13 13:33:19 -06:00
target_core_iblock.h target: kill struct se_subsystem_dev 2012-11-06 20:55:43 -08:00
target_core_internal.h target: make target db location configurable 2016-05-09 23:06:15 -07:00
target_core_pr.c target: use new "dbroot" target attribute 2016-05-09 23:06:20 -07:00
target_core_pr.h target: use 64-bit LUNs 2015-06-15 23:26:01 -07:00
target_core_pscsi.c block: add a bi_error field to struct bio 2015-07-29 08:55:15 -06:00
target_core_pscsi.h SCSI misc on 20150622 2015-06-23 15:55:44 -07:00
target_core_rd.c target: need_to_release is always false, remove redundant check and kfree 2016-05-10 01:19:55 -07:00
target_core_rd.h target/rd: Add support for protection SGL setup + release 2014-01-19 02:22:05 +00:00
target_core_sbc.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2016-01-20 17:20:53 -08:00
target_core_spc.c target: Remove enum transport_lunflags_table 2016-03-10 21:48:55 -08:00
target_core_stat.c configfs: switch ->default groups to a linked list 2016-03-06 16:11:24 +01:00
target_core_tmr.c target: Drop incorrect ABORT_TASK put for completed commands 2016-03-05 20:24:47 -08:00
target_core_tpg.c target: remove sess_kref and ->shutdown_session 2016-05-10 01:19:49 -07:00
target_core_transport.c target: Fix race between iscsi-target connection shutdown + ABORT_TASK 2016-07-20 00:58:34 -07:00
target_core_ua.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-07-04 14:13:43 -07:00
target_core_ua.h target: Send UA when changing LUN inventory 2015-06-23 00:43:02 -07:00
target_core_user.c target/user: Report capability of handling out-of-order completions to userspace 2016-03-10 21:49:09 -08:00
target_core_xcopy.c target: enhance and export target_alloc_sgl/target_free_sgl 2016-05-13 13:37:19 -04:00
target_core_xcopy.h target: Add support for EXTENDED_COPY copy offload emulation 2013-09-10 16:48:43 -07:00