If a Simple command is sent with an Unsupported SCSI Opcode (failure), target_setup_cmd_from_cdb returns with TCM_UNSUPPORTED_SCSI_OPCODE which then causes transport_generic_request_failure to decrement simple_cmds, due to call to transport_complete_task_attr. With this dev->simple_cmds or dev->dev_ordered_sync is now -1, not 0. So when a subsequent command with an Ordered Task is sent, it causes a hang, since dev->simple_cmds is at -1. Thus to prevent Unsupported SCSI Opcode Failure from decrementing simple_cmds I added a check to skip transport_complete_task_attr for sense_reaons that are TCM_UNSUPPORTED_SCSI_OPCODE. I dont know if this is a proper fix, but it worked for me, let me know what you think Nick. Signed-off-by: Bryant G. Ly <bryantly@xxxxxxxxxxxxxxxxxx> --- drivers/target/target_core_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 6c089af..4578fcf 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1684,7 +1684,8 @@ void transport_generic_request_failure(struct se_cmd *cmd, /* * For SAM Task Attribute emulation for failed struct se_cmd */ - transport_complete_task_attr(cmd); + if (sense_reason != TCM_UNSUPPORTED_SCSI_OPCODE) + transport_complete_task_attr(cmd); /* * Handle special case for COMPARE_AND_WRITE failure, where the * callback is expected to drop the per device ->caw_sem. -- Sorry this patch takes out the additional stuff that was picked up for some reason when I did a new branch from for-next... 2.5.4 (Apple Git-61) -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html