linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] scsi : fixing the new host byte settings (DID_TARGET_FAILURE and DID_NEXUS_FAILURE)
@ 2012-01-24 20:38 Moger, Babu
  2012-01-24 23:03 ` Mike Snitzer
  0 siblings, 1 reply; 5+ messages in thread
From: Moger, Babu @ 2012-01-24 20:38 UTC (permalink / raw)
  To: linux-scsi@vger.kernel.org
  Cc: device-mapper development (dm-devel@redhat.com)

Resubmitting as my previous post had format issues and did not go linux-scsi.

This patch fixes the host byte settings DID_TARGET_FAILURE and DID_NEXUS_FAILURE.
The function __scsi_error_from_host_byte,  tries to reset the host byte to DID_OK. But that
does not happen because of the OR operation. 

Here is the flow.
scsi_softirq_done-> scsi_decide_disposition -> __scsi_error_from_host_byte

Let's take an example with DID_NEXUS_FAILURE. In scsi_decide_disposition, result will be set as
DID_NEXUS_FAILURE (=0x11). Then in __scsi_error_from_host_byte, when we do OR with 
DID_OK.  Purpose is to reset it back to DID_OK. But that does not happen.  This patch fixes this issue. 

Signed-off-by: Babu Moger <babu.moger@netapp.com>
---
diff -uprN -X linux-3.3-rc1/Documentation/dontdiff linux-3.3-rc1//drivers/scsi/scsi_error.c linux-3.3-rc1-new//drivers/scsi/scsi_error.c
--- linux-3.3-rc1//drivers/scsi/scsi_error.c	2012-01-19 17:04:48.000000000 -0600
+++ linux-3.3-rc1-new//drivers/scsi/scsi_error.c	2012-01-23 11:55:26.000000000 -0600
@@ -1540,7 +1540,7 @@ int scsi_decide_disposition(struct scsi_
 			 * Need to modify host byte to signal a
 			 * permanent target failure
 			 */
-			scmd->result |= (DID_TARGET_FAILURE << 16);
+			set_host_byte(scmd, DID_TARGET_FAILURE);
 			rtn = SUCCESS;
 		}
 		/* if rtn == FAILED, we have no sense information;
@@ -1560,7 +1560,7 @@ int scsi_decide_disposition(struct scsi_
 	case RESERVATION_CONFLICT:
 		sdev_printk(KERN_INFO, scmd->device,
 			    "reservation conflict\n");
-		scmd->result |= (DID_NEXUS_FAILURE << 16);
+		set_host_byte(scmd, DID_NEXUS_FAILURE);
 		return SUCCESS; /* causes immediate i/o error */
 	default:
 		return FAILED;
diff -uprN -X linux-3.3-rc1/Documentation/dontdiff linux-3.3-rc1//drivers/scsi/scsi_lib.c linux-3.3-rc1-new//drivers/scsi/scsi_lib.c
--- linux-3.3-rc1//drivers/scsi/scsi_lib.c	2012-01-19 17:04:48.000000000 -0600
+++ linux-3.3-rc1-new//drivers/scsi/scsi_lib.c	2012-01-23 11:50:25.000000000 -0600
@@ -682,11 +682,11 @@ static int __scsi_error_from_host_byte(s
 		error = -ENOLINK;
 		break;
 	case DID_TARGET_FAILURE:
-		cmd->result |= (DID_OK << 16);
+		set_host_byte(cmd, DID_OK);
 		error = -EREMOTEIO;
 		break;
 	case DID_NEXUS_FAILURE:
-		cmd->result |= (DID_OK << 16);
+		set_host_byte(cmd, DID_OK);
 		error = -EBADE;
 		break;
 	default:



^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH 2/2] scsi : fixing the new host byte settings (DID_TARGET_FAILURE and DID_NEXUS_FAILURE)
@ 2012-01-23 18:43 Moger, Babu
  0 siblings, 0 replies; 5+ messages in thread
From: Moger, Babu @ 2012-01-23 18:43 UTC (permalink / raw)
  To: linux-scsi@vger.kernel.org
  Cc: device-mapper development (dm-devel@redhat.com)


[-- Attachment #1.1: Type: text/plain, Size: 2631 bytes --]

This patch fixes the host byte settings DID_TARGET_FAILURE and DID_NEXUS_FAILURE.

The function __scsi_error_from_host_byte,  tries to reset the host byte to DID_OK. But that

does not happen because of the OR operation.



Here is the flow.

scsi_softirq_done-> scsi_decide_disposition -> __scsi_error_from_host_byte



Let's take an example with DID_NEXUS_FAILURE. In scsi_decide_disposition, result will be set as

DID_NEXUS_FAILURE (=0x11). Then in __scsi_error_from_host_byte, when we do OR with

DID_OK.  Purpose is to reset it back to DID_OK. But that does not happen.  This patch fixes this issue.



Signed-off-by: Babu Moger <babu.moger@netapp.com>

---

diff -uprN -X linux-3.3-rc1/Documentation/dontdiff linux-3.3-rc1//drivers/scsi/scsi_error.c linux-3.3-rc1-new//drivers/scsi/scsi_error.c
--- linux-3.3-rc1//drivers/scsi/scsi_error.c    2012-01-19 17:04:48.000000000 -0600
+++ linux-3.3-rc1-new//drivers/scsi/scsi_error.c      2012-01-23 11:55:26.000000000 -0600
@@ -1540,7 +1540,7 @@ int scsi_decide_disposition(struct scsi_
                   * Need to modify host byte to signal a
                   * permanent target failure
                   */
-                 scmd->result |= (DID_TARGET_FAILURE << 16);
+                 set_host_byte(scmd, DID_TARGET_FAILURE);
                  rtn = SUCCESS;
            }
            /* if rtn == FAILED, we have no sense information;
@@ -1560,7 +1560,7 @@ int scsi_decide_disposition(struct scsi_
      case RESERVATION_CONFLICT:
            sdev_printk(KERN_INFO, scmd->device,
                      "reservation conflict\n");
-           scmd->result |= (DID_NEXUS_FAILURE << 16);
+           set_host_byte(scmd, DID_NEXUS_FAILURE);
            return SUCCESS; /* causes immediate i/o error */
      default:
            return FAILED;
diff -uprN -X linux-3.3-rc1/Documentation/dontdiff linux-3.3-rc1//drivers/scsi/scsi_lib.c linux-3.3-rc1-new//drivers/scsi/scsi_lib.c
--- linux-3.3-rc1//drivers/scsi/scsi_lib.c      2012-01-19 17:04:48.000000000 -0600
+++ linux-3.3-rc1-new//drivers/scsi/scsi_lib.c  2012-01-23 11:50:25.000000000 -0600
@@ -682,11 +682,11 @@ static int __scsi_error_from_host_byte(s
            error = -ENOLINK;
            break;
      case DID_TARGET_FAILURE:
-           cmd->result |= (DID_OK << 16);
+           set_host_byte(cmd, DID_OK);
            error = -EREMOTEIO;
            break;
      case DID_NEXUS_FAILURE:
-           cmd->result |= (DID_OK << 16);
+           set_host_byte(cmd, DID_OK);
            error = -EBADE;
            break;
      default:








[-- Attachment #1.2: Type: text/html, Size: 31210 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-25 22:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24 20:38 [PATCH 2/2] scsi : fixing the new host byte settings (DID_TARGET_FAILURE and DID_NEXUS_FAILURE) Moger, Babu
2012-01-24 23:03 ` Mike Snitzer
2012-01-25 21:39   ` Moger, Babu
2012-01-25 22:47     ` Mike Snitzer
  -- strict thread matches above, loose matches on Subject: below --
2012-01-23 18:43 Moger, Babu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).