target: Fix target_submit_cmd() exception handling
authorNicholas Bellinger <nab@linux-iscsi.org>
Sat, 21 Jan 2012 03:02:56 +0000 (19:02 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 7 Feb 2012 06:47:11 +0000 (06:47 +0000)
commit735703cac08f34a197e1c6331ca9adc8a52d6046
tree93e3e09572f681f9f3a360832ba4a84a6f99018e
parent1edcdb497ef418122cd4f98e157660cf594b345a
target: Fix target_submit_cmd() exception handling

This patch fixes a bug in target_submit_cmd() where the failure path
for transport_generic_allocate_tasks() made a direct call to
transport_send_check_condition_and_sense() and not calling the
final target_put_sess_cmd() release callback.

For transport_generic_allocate_tasks() failures, use the proper call to
transport_generic_request_failure() to handle kref_put() along
with potential internal queue full response processing.

It also makes transport_lookup_cmd_lun() failures in
target_submit_cmd() use transport_send_check_condition_and_sense() and
target_put_sess_cmd() directly to avoid se_cmd->se_dev reference in
transport_generic_request_failure() handling.

Finally it drops the out_check_cond: label and use direct reference for
allocate task failures, and per-se_device queue_full handling is
currently not supported for transport_lookup_cmd_lun() failure
descriptors due to se_device dependency.

Reported-by: Roland Dreier <roland@purestorage.com>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_transport.c