]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
target: Fix ordered task target_setup_cmd_from_cdb exception hang
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 18 May 2016 05:19:10 +0000 (22:19 -0700)
committerKamal Mostafa <kamal@canonical.com>
Mon, 22 Aug 2016 14:43:10 +0000 (07:43 -0700)
commitb9c3e559bc05084c581678c864eab75ef6226a6e
tree21430dc0394d8926d9440667d1ad5b88aabf1ad5
parentb92d5f6b25a384c138e87417729c717a6cf71fb2
target: Fix ordered task target_setup_cmd_from_cdb exception hang

BugLink: http://bugs.launchpad.net/bugs/1615620
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.

Reported-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Tested-by: Michael Cyr <mikecyr@linux.vnet.ibm.com>
Reported-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Tested-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/target/target_core_internal.h
drivers/target/target_core_sbc.c
drivers/target/target_core_transport.c
include/target/target_core_fabric.h