diff mbox series

[05/11] aacraid: use midlayer helper to terminate outstanding commands

Message ID 20191120103114.24723-6-hare@suse.de (mailing list archive)
State Superseded
Headers show
Series scsi: remove legacy cmd_list implementation | expand

Commit Message

Hannes Reinecke Nov. 20, 2019, 10:31 a.m. UTC
Use scsi_host_flush_commands() to terminate all outstanding commands
instead, and change the command result for terminated commands to
the more common 'DID_RESET' instead of 'QUEUE_FULL'.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/aacraid/commsup.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

Comments

Christoph Hellwig Nov. 26, 2019, 5:02 p.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Balsundar.P@microchip.com Nov. 28, 2019, 11:41 a.m. UTC | #2
Acked-by: Balsundar P < Balsundar.P@microchip.com>

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, November 20, 2019 16:01
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Balsundar P <balsundar.p@microsemi.com>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 05/11] aacraid: use midlayer helper to terminate outstanding commands

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use scsi_host_flush_commands() to terminate all outstanding commands instead, and change the command result for terminated commands to the more common 'DID_RESET' instead of 'QUEUE_FULL'.

Cc: Balsundar P <balsundar.p@microsemi.com>
Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/aacraid/commsup.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 5a8a999606ea..e413b784a8d0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1478,8 +1478,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
        int retval;
        struct Scsi_Host *host;
        struct scsi_device *dev;
-       struct scsi_cmnd *command;
-       struct scsi_cmnd *command_list;
        int jafo = 0;
        int bled;
        u64 dmamask;
@@ -1607,26 +1605,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
         * This is where the assumption that the Adapter is quiesced
         * is important.
         */
-       command_list = NULL;
-       __shost_for_each_device(dev, host) {
-               unsigned long flags;
-               spin_lock_irqsave(&dev->list_lock, flags);
-               list_for_each_entry(command, &dev->cmd_list, list)
-                       if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-                               command->SCp.buffer = (struct scatterlist *)command_list;
-                               command_list = command;
-                       }
-               spin_unlock_irqrestore(&dev->list_lock, flags);
-       }
-       while ((command = command_list)) {
-               command_list = (struct scsi_cmnd *)command->SCp.buffer;
-               command->SCp.buffer = NULL;
-               command->result = DID_OK << 16
-                 | COMMAND_COMPLETE << 8
-                 | SAM_STAT_TASK_SET_FULL;
-               command->SCp.phase = AAC_OWNER_ERROR_HANDLER;
-               command->scsi_done(command);
-       }
+       scsi_host_flush_commands(host, DID_RESET);
+
        /*
         * Any Device that was already marked offline needs to be marked
         * running
--
2.16.4
diff mbox series

Patch

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 5a8a999606ea..e413b784a8d0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1478,8 +1478,6 @@  static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	int retval;
 	struct Scsi_Host *host;
 	struct scsi_device *dev;
-	struct scsi_cmnd *command;
-	struct scsi_cmnd *command_list;
 	int jafo = 0;
 	int bled;
 	u64 dmamask;
@@ -1607,26 +1605,8 @@  static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
 	 * This is where the assumption that the Adapter is quiesced
 	 * is important.
 	 */
-	command_list = NULL;
-	__shost_for_each_device(dev, host) {
-		unsigned long flags;
-		spin_lock_irqsave(&dev->list_lock, flags);
-		list_for_each_entry(command, &dev->cmd_list, list)
-			if (command->SCp.phase == AAC_OWNER_FIRMWARE) {
-				command->SCp.buffer = (struct scatterlist *)command_list;
-				command_list = command;
-			}
-		spin_unlock_irqrestore(&dev->list_lock, flags);
-	}
-	while ((command = command_list)) {
-		command_list = (struct scsi_cmnd *)command->SCp.buffer;
-		command->SCp.buffer = NULL;
-		command->result = DID_OK << 16
-		  | COMMAND_COMPLETE << 8
-		  | SAM_STAT_TASK_SET_FULL;
-		command->SCp.phase = AAC_OWNER_ERROR_HANDLER;
-		command->scsi_done(command);
-	}
+	scsi_host_flush_commands(host, DID_RESET);
+
 	/*
 	 * Any Device that was already marked offline needs to be marked
 	 * running