diff mbox

[07/47] aacraid: complete all commands during bus reset

Message ID 1498638793-44672-8-git-send-email-hare@suse.de (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Hannes Reinecke June 28, 2017, 8:32 a.m. UTC
When issuing a bus reset we should complete all commands, not
just the command triggering the reset.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/aacraid/linit.c | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

Comments

Johannes Thumshirn June 28, 2017, 9:19 a.m. UTC | #1
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Raghava Aditya Renukunta June 29, 2017, 8:07 p.m. UTC | #2
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of Hannes Reinecke
> Sent: Wednesday, June 28, 2017 1:33 AM
> To: Christoph Hellwig <hch@lst.de>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>; James Bottomley
> <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org;
> Hannes Reinecke <hare@suse.de>; Hannes Reinecke <hare@suse.com>
> Subject: [PATCH 07/47] aacraid: complete all commands during bus reset
> 
> EXTERNAL EMAIL
> 
> 
> When issuing a bus reset we should complete all commands, not
> just the command triggering the reset.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/aacraid/linit.c | 34 ++++++++++++++++++++--------------
>  1 file changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
> index 9b284a0..c26130e 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -1007,23 +1007,29 @@ static int aac_eh_bus_reset(struct scsi_cmnd*
> cmd)
>         struct Scsi_Host * host = dev->host;
>         struct aac_dev * aac = (struct aac_dev *)host->hostdata;
>         int count;
> -       u32 bus, cid;
> +       u32 cmd_bus;
>         int status = 0;
> 
> 
> -       bus = aac_logical_to_phys(scmd_channel(cmd));
> -       cid = scmd_id(cmd);
> -       if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS ||
> -           aac->hba_map[bus][cid].devtype != AAC_DEVTYPE_NATIVE_RAW) {
> -               /* Mark the assoc. FIB to not complete, eh handler does this */
> -               for (count = 0;
> -                       count < (host->can_queue + AAC_NUM_MGT_FIB);
> -                       ++count) {
> -                       struct fib *fib = &aac->fibs[count];
> -
> -                       if (fib->hw_fib_va->header.XferState &&
> -                               (fib->flags & FIB_CONTEXT_FLAG) &&
> -                               (fib->callback_data == cmd)) {
> +       cmd_bus = aac_logical_to_phys(scmd_channel(cmd));
> +       /* Mark the assoc. FIB to not complete, eh handler does this */
> +       for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB);
> ++count) {
> +               struct fib *fib = &aac->fibs[count];
> +
> +               if (fib->hw_fib_va->header.XferState &&
> +                   (fib->flags & FIB_CONTEXT_FLAG) &&
> +                   (fib->flags & FIB_CONTEXT_FLAG_SCSI_CMD)) {
> +                       struct aac_hba_map_info *info;
> +                       u32 bus, cid;
> +
> +                       cmd = (struct scsi_cmnd *)fib->callback_data;
> +                       bus = aac_logical_to_phys(scmd_channel(cmd));
> +                       if (bus != cmd_bus)
> +                               continue;
> +                       cid = scmd_id(cmd);
> +                       info = &aac->hba_map[bus][cid];
> +                       if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS ||
> +                           info->devtype != AAC_DEVTYPE_NATIVE_RAW) {
>                                 fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
>                                 cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
>                         }
> --
> 1.8.5.6

Reviewed-by: Raghava Aditya Renukunta  <RaghavaAditya.Renukunta@microsemi.com>
diff mbox

Patch

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9b284a0..c26130e 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1007,23 +1007,29 @@  static int aac_eh_bus_reset(struct scsi_cmnd* cmd)
 	struct Scsi_Host * host = dev->host;
 	struct aac_dev * aac = (struct aac_dev *)host->hostdata;
 	int count;
-	u32 bus, cid;
+	u32 cmd_bus;
 	int status = 0;
 
 
-	bus = aac_logical_to_phys(scmd_channel(cmd));
-	cid = scmd_id(cmd);
-	if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS ||
-	    aac->hba_map[bus][cid].devtype != AAC_DEVTYPE_NATIVE_RAW) {
-		/* Mark the assoc. FIB to not complete, eh handler does this */
-		for (count = 0;
-			count < (host->can_queue + AAC_NUM_MGT_FIB);
-			++count) {
-			struct fib *fib = &aac->fibs[count];
-
-			if (fib->hw_fib_va->header.XferState &&
-				(fib->flags & FIB_CONTEXT_FLAG) &&
-				(fib->callback_data == cmd)) {
+	cmd_bus = aac_logical_to_phys(scmd_channel(cmd));
+	/* Mark the assoc. FIB to not complete, eh handler does this */
+	for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
+		struct fib *fib = &aac->fibs[count];
+
+		if (fib->hw_fib_va->header.XferState &&
+		    (fib->flags & FIB_CONTEXT_FLAG) &&
+		    (fib->flags & FIB_CONTEXT_FLAG_SCSI_CMD)) {
+			struct aac_hba_map_info *info;
+			u32 bus, cid;
+
+			cmd = (struct scsi_cmnd *)fib->callback_data;
+			bus = aac_logical_to_phys(scmd_channel(cmd));
+			if (bus != cmd_bus)
+				continue;
+			cid = scmd_id(cmd);
+			info = &aac->hba_map[bus][cid];
+			if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS ||
+			    info->devtype != AAC_DEVTYPE_NATIVE_RAW) {
 				fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
 				cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
 			}