Commit 2082ebc45af9c9c648383b8cde0dc1948eadbf31

Authored by Moger, Babu
Committed by James Bottomley
1 parent 3384db9eb8

[SCSI] fix the new host byte settings (DID_TARGET_FAILURE and DID_NEXUS_FAILURE)

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>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

Showing 2 changed files with 4 additions and 4 deletions Side-by-side Diff

drivers/scsi/scsi_error.c
... ... @@ -1540,7 +1540,7 @@
1540 1540 * Need to modify host byte to signal a
1541 1541 * permanent target failure
1542 1542 */
1543   - scmd->result |= (DID_TARGET_FAILURE << 16);
  1543 + set_host_byte(scmd, DID_TARGET_FAILURE);
1544 1544 rtn = SUCCESS;
1545 1545 }
1546 1546 /* if rtn == FAILED, we have no sense information;
... ... @@ -1560,7 +1560,7 @@
1560 1560 case RESERVATION_CONFLICT:
1561 1561 sdev_printk(KERN_INFO, scmd->device,
1562 1562 "reservation conflict\n");
1563   - scmd->result |= (DID_NEXUS_FAILURE << 16);
  1563 + set_host_byte(scmd, DID_NEXUS_FAILURE);
1564 1564 return SUCCESS; /* causes immediate i/o error */
1565 1565 default:
1566 1566 return FAILED;
drivers/scsi/scsi_lib.c
... ... @@ -682,11 +682,11 @@
682 682 error = -ENOLINK;
683 683 break;
684 684 case DID_TARGET_FAILURE:
685   - cmd->result |= (DID_OK << 16);
  685 + set_host_byte(cmd, DID_OK);
686 686 error = -EREMOTEIO;
687 687 break;
688 688 case DID_NEXUS_FAILURE:
689   - cmd->result |= (DID_OK << 16);
  689 + set_host_byte(cmd, DID_OK);
690 690 error = -EBADE;
691 691 break;
692 692 default: