Skip to contentSkip to conversation

Patch "target: Fix ordered task target_setup_cmd_from_cdb exception hang" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Aug 18, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

target: Fix ordered task target_setup_cmd_from_cdb exception hang

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
target-fix-ordered-task-target_setup_cmd_from_cdb-exception-hang.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From dff0ca9ea7dc8be2181a62df4a722c32ce68ff4a Mon Sep 17 00:00:00 2001

From: Nicholas Bellinger <[email protected]>
Date: Tue, 17 May 2016 22:19:10 -0700
Subject: target: Fix ordered task target_setup_cmd_from_cdb exception hang

From: Nicholas Bellinger <[email protected]>

commit dff0ca9ea7dc8be2181a62df4a722c32ce68ff4a upstream.

If a command with a Simple task attribute is failed due to a Unit Attention, then a subsequent command with an Ordered task attribute will hang forever. The reason for this is that the Unit Attention status is checked for in target_setup_cmd_from_cdb, before the call to target_execute_cmd, which calls target_handle_task_attr, which in turn increments dev->simple_cmds.

However, transport_generic_request_failure still calls transport_complete_task_attr, which will decrement dev->simple_cmds. In this case, simple_cmds is now -1. So when a command with the Ordered task attribute is sent, target_handle_task_attr sees that dev->simple_cmds is not 0, so it decides it can't execute the command until all the (nonexistent) Simple commands have completed.

---
 drivers/target/target_core_internal.h  |    1 
 drivers/target/target_core_sbc.c       |    2 -
 drivers/target/target_core_transport.c |   62 ++++++++++++++++++---------------
 include/target/target_core_fabric.h    |    1 
 4 files changed, 37 insertions(+), 29 deletions(-)
drivers/target/target_core_internal.h +1 -0
@@ -148,6 +148,7 @@ sense_reason_t	target_cmd_size_check(str
 void	target_qf_do_work(struct work_struct *work);
 bool	target_check_wce(struct se_device *dev);
 bool	target_check_fua(struct se_device *dev);
+void	__target_execute_cmd(struct se_cmd *, bool);
 
 /* target_core_stat.c */
 void	target_stat_setup_dev_default_groups(struct se_device *);
drivers/target/target_core_sbc.c +1 -1
@@ -594,7 +594,7 @@ static sense_reason_t compare_and_write_
 	cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT;
 	spin_unlock_irq(&cmd->t_state_lock);
 
-	__target_execute_cmd(cmd);
+	__target_execute_cmd(cmd, false);
 
 	kfree(buf);
 	return ret;
drivers/target/target_core_transport.c +35 -27

92 lines not on this page · raw message

include/target/target_core_fabric.h +0 -1
@@ -163,7 +163,6 @@ int	core_tmr_alloc_req(struct se_cmd *,
 void	core_tmr_release_req(struct se_tmr_req *);
 int	transport_generic_handle_tmr(struct se_cmd *);
 void	transport_generic_request_failure(struct se_cmd *, sense_reason_t);
-void	__target_execute_cmd(struct se_cmd *);
 int	transport_lookup_tmr_lun(struct se_cmd *, u64);
 void	core_allocate_nexus_loss_ua(struct se_node_acl *acl);
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/target-fix-max_unmap_lba_count-calc-overflow.patch queue-4.4/target-fix-ordered-task-check_condition-early-exception-handling.patch queue-4.4/target-fix-race-between-iscsi-target-connection-shutdown-abort_task.patch queue-4.4/target-fix-ordered-task-target_setup_cmd_from_cdb-exception-hang.patch queue-4.4/iscsi-target-fix-panic-when-adding-second-tcp-connection-to-iscsi-session.patch queue-4.4/target-fix-missing-complete-during-abort_task-cmd_t_fabric_stop.patch