[SCSI] mvsas: retry aborting task.
authorKe Wei <kewei@marvell.com>
Thu, 27 Mar 2008 06:55:04 +0000 (14:55 +0800)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 28 Mar 2008 17:31:40 +0000 (12:31 -0500)
Signed-off-by: Ke Wei <kewei@marvell.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/mvsas.c

index ebfe1649443ace74bd99a5a0b766cdd323759914..f4f7b0af30278ee2770b7e9701d58a9bf459d5ab 100644 (file)
@@ -2159,42 +2159,59 @@ out_done:
 
 static int mvs_task_abort(struct sas_task *task)
 {
-       int rc = 1;
+       int rc;
        unsigned long flags;
        struct mvs_info *mvi = task->dev->port->ha->lldd_ha;
        struct pci_dev *pdev = mvi->pdev;
+       int tag;
 
        spin_lock_irqsave(&task->task_state_lock, flags);
        if (task->task_state_flags & SAS_TASK_STATE_DONE) {
                rc = TMF_RESP_FUNC_COMPLETE;
+               spin_unlock_irqrestore(&task->task_state_lock, flags);
                goto out_done;
        }
        spin_unlock_irqrestore(&task->task_state_lock, flags);
 
-       /*FIXME*/
-       rc = TMF_RESP_FUNC_COMPLETE;
-
        switch (task->task_proto) {
        case SAS_PROTOCOL_SMP:
-               dev_printk(KERN_DEBUG, &pdev->dev, "SMP Abort! ");
+               dev_printk(KERN_DEBUG, &pdev->dev, "SMP Abort! \n");
                break;
        case SAS_PROTOCOL_SSP:
-               dev_printk(KERN_DEBUG, &pdev->dev, "SSP Abort! ");
+               dev_printk(KERN_DEBUG, &pdev->dev, "SSP Abort! \n");
                break;
        case SAS_PROTOCOL_SATA:
        case SAS_PROTOCOL_STP:
        case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:{
-               dev_printk(KERN_DEBUG, &pdev->dev, "STP Abort! "
-                       "Dump D2H FIS: \n");
+               dev_printk(KERN_DEBUG, &pdev->dev, "STP Abort! \n");
+#if _MV_DUMP
+               dev_printk(KERN_DEBUG, &pdev->dev, "Dump D2H FIS: \n");
                mvs_hexdump(sizeof(struct host_to_dev_fis),
                                (void *)&task->ata_task.fis, 0);
                dev_printk(KERN_DEBUG, &pdev->dev, "Dump ATAPI Cmd : \n");
                mvs_hexdump(16, task->ata_task.atapi_packet, 0);
+#endif
+               spin_lock_irqsave(&task->task_state_lock, flags);
+               if (task->task_state_flags & SAS_TASK_NEED_DEV_RESET) {
+                       /* TODO */
+                       ;
+               }
+               spin_unlock_irqrestore(&task->task_state_lock, flags);
                break;
        }
        default:
                break;
        }
+
+       if (mvs_find_tag(mvi, task, &tag)) {
+               spin_lock_irqsave(&mvi->lock, flags);
+               mvs_slot_task_free(mvi, task, &mvi->slot_info[tag], tag);
+               spin_unlock_irqrestore(&mvi->lock, flags);
+       }
+       if (!mvs_task_exec(task, 1, GFP_ATOMIC))
+               rc = TMF_RESP_FUNC_COMPLETE;
+       else
+               rc = TMF_RESP_FUNC_FAILED;
 out_done:
        return rc;
 }