Browse Source

[SCSI] qla2xxx: Correct eh_abort recovery logic.

Fix the driver to return SUCCESS if the firmware or driver doesn't
have a command to abort, i.e., it's already been returned.  Without
this patch, error recovery will take the target offline as it tries
harder and harder to get the driver to return the command it no longer
has.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Michael Reed 19 years ago
parent
commit
2ea0020250
1 changed files with 9 additions and 6 deletions
  1. 9 6
      drivers/scsi/qla2xxx/qla_os.c

+ 9 - 6
drivers/scsi/qla2xxx/qla_os.c

@@ -599,6 +599,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
 *    Either SUCCESS or FAILED.
 *    Either SUCCESS or FAILED.
 *
 *
 * Note:
 * Note:
+*    Only return FAILED if command not returned by firmware.
 **************************************************************************/
 **************************************************************************/
 int
 int
 qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 qla2xxx_eh_abort(struct scsi_cmnd *cmd)
@@ -609,11 +610,12 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	unsigned int id, lun;
 	unsigned int id, lun;
 	unsigned long serial;
 	unsigned long serial;
 	unsigned long flags;
 	unsigned long flags;
+	int wait = 0;
 
 
 	if (!CMD_SP(cmd))
 	if (!CMD_SP(cmd))
-		return FAILED;
+		return SUCCESS;
 
 
-	ret = FAILED;
+	ret = SUCCESS;
 
 
 	id = cmd->device->id;
 	id = cmd->device->id;
 	lun = cmd->device->lun;
 	lun = cmd->device->lun;
@@ -642,7 +644,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 		} else {
 		} else {
 			DEBUG3(printk("%s(%ld): abort_command "
 			DEBUG3(printk("%s(%ld): abort_command "
 			    "mbx success.\n", __func__, ha->host_no));
 			    "mbx success.\n", __func__, ha->host_no));
-			ret = SUCCESS;
+			wait = 1;
 		}
 		}
 		spin_lock_irqsave(&ha->hardware_lock, flags);
 		spin_lock_irqsave(&ha->hardware_lock, flags);
 
 
@@ -651,17 +653,18 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
 
 	/* Wait for the command to be returned. */
 	/* Wait for the command to be returned. */
-	if (ret == SUCCESS) {
+	if (wait) {
 		if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) {
 		if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) {
 			qla_printk(KERN_ERR, ha,
 			qla_printk(KERN_ERR, ha,
 			    "scsi(%ld:%d:%d): Abort handler timed out -- %lx "
 			    "scsi(%ld:%d:%d): Abort handler timed out -- %lx "
 			    "%x.\n", ha->host_no, id, lun, serial, ret);
 			    "%x.\n", ha->host_no, id, lun, serial, ret);
+			ret = FAILED;
 		}
 		}
 	}
 	}
 
 
 	qla_printk(KERN_INFO, ha,
 	qla_printk(KERN_INFO, ha,
-	    "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no,
-	    id, lun, serial, ret);
+	    "scsi(%ld:%d:%d): Abort command issued -- %d %lx %x.\n",
+	    ha->host_no, id, lun, wait, serial, ret);
 
 
 	return ret;
 	return ret;
 }
 }