[PATCH 1/3] megaraid: complete all commands in megaraid_reset()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When calling host reset all commands need to be completed, not
just that one triggering SCSI EH.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 drivers/scsi/megaraid.c | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 56910e94dbf2..10c1793d4b6d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1887,7 +1887,8 @@ megaraid_reset(struct scsi_cmnd *cmd)
 {
 	adapter_t	*adapter;
 	megacmd_t	mc;
-	int		rval;
+	int		rval = SUCCESS;
+	struct list_head	*pos, *next;
 
 	adapter = (adapter_t *)cmd->device->host->hostdata;
 
@@ -1905,7 +1906,37 @@ megaraid_reset(struct scsi_cmnd *cmd)
 
 	spin_lock_irq(&adapter->lock);
 
-	rval =  megaraid_abort_and_reset(adapter, cmd, SCB_RESET);
+	dev_warn(&adapter->dev->dev, "RESET HBA\n");
+
+	list_for_each_safe(pos, next, &adapter->pending_list) {
+		scb_t *scb = list_entry(pos, scb_t, list);
+
+		scb->state |= SCB_RESET;
+
+		/*
+		 * Check if this command has firmware ownership. If
+		 * yes, we cannot reset this command. Whenever f/w
+		 * completes this command, we will return appropriate
+		 * status from ISR.
+		 */
+		if( scb->state & SCB_ISSUED ) {
+			dev_warn(&adapter->dev->dev,
+				 "RESET[%x], fw owner\n",
+				 scb->idx);
+			rval = FAILED;
+			break;
+		}
+		/*
+		 * Not yet issued! Remove from the pending
+		 * list
+		 */
+		dev_warn(&adapter->dev->dev,
+			 "RESET[%x], driver owner\n", scb->idx);
+		scb->cmd->result = (DID_RESET << 16);
+		list_add_tail(SCSI_LIST(scb->cmd),
+			      &adapter->completed_list);
+		mega_free_scb(adapter, scb);
+	}
 
 	/*
 	 * This is required here to complete any completed requests
-- 
2.29.2




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux