[SCSI] qla4xxx: Fix cmd check in qla4xxx_cmd_wait

If the command has timedout then the block layer has called
blk_mark_rq_complete. If qla4xxx_cmd_wait is then called
from qla4xxx_eh_host_reset, we will always fail, because if
the driver calls scsi_done then the the block layer will fail
at blk_complete_request's blk_mark_rq_complete call instead of
calling the normal completion path including the function,
blk_queue_end_tag, which releases the tag.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by Mike Christie and committed by James Bottomley a1e0063d e340c353

+7 -1
+7 -1
drivers/scsi/qla4xxx/ql4_os.c
··· 881 /* Find a command that hasn't completed. */ 882 for (index = 0; index < ha->host->can_queue; index++) { 883 cmd = scsi_host_find_tag(ha->host, index); 884 - if (cmd != NULL) 885 break; 886 } 887 spin_unlock_irqrestore(&ha->hardware_lock, flags);
··· 881 /* Find a command that hasn't completed. */ 882 for (index = 0; index < ha->host->can_queue; index++) { 883 cmd = scsi_host_find_tag(ha->host, index); 884 + /* 885 + * We cannot just check if the index is valid, 886 + * becase if we are run from the scsi eh, then 887 + * the scsi/block layer is going to prevent 888 + * the tag from being released. 889 + */ 890 + if (cmd != NULL && CMD_SP(cmd)) 891 break; 892 } 893 spin_unlock_irqrestore(&ha->hardware_lock, flags);