@@ -939,8 +939,15 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
int rval, wait = 0;
struct qla_hw_data *ha = vha->hw;
- if (!CMD_SP(cmd))
+ if (!CMD_SP(cmd)) {
+ /*
+ * Wait until io done finishs to avoid race between
+ * io timeout and io done.
+ */
+ spin_lock_irqsave(&ha->hardware_lock, flags);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
return SUCCESS;
+ }
ret = fc_block_scsi_eh(cmd);
if (ret != 0)
@@ -996,8 +1003,15 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
spin_unlock_irqrestore(&ha->hardware_lock, flags);
/* Did the command return during mailbox execution? */
- if (ret == FAILED && !CMD_SP(cmd))
+ if (ret == FAILED && !CMD_SP(cmd)) {
+ /*
+ * Wait until io done finishs to avoid race between
+ * io timeout and io done.
+ */
+ spin_lock_irqsave(&ha->hardware_lock, flags);
+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
ret = SUCCESS;
+ }
/* Wait for the command to be returned. */
if (wait) {