Skip to content

Commit e95153b

Browse files
Jim Gillmartinkpetersen
authored andcommitted
scsi: vmw_pvscsi: Return DID_RESET for status SAM_STAT_COMMAND_TERMINATED
Commands that are reset are returned with status SAM_STAT_COMMAND_TERMINATED. PVSCSI currently returns DID_OK | SAM_STAT_COMMAND_TERMINATED which fails the command. Instead, set hostbyte to DID_RESET to allow upper layers to retry. Tested by copying a large file between two pvscsi disks on same adapter while performing a bus reset at 1-second intervals. Before fix, commands sometimes fail with DID_OK. After fix, commands observed to fail with DID_RESET. Signed-off-by: Jim Gill <jgill@vmware.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 1214fd7 commit e95153b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/scsi/vmw_pvscsi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,14 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
561561
(btstat == BTSTAT_SUCCESS ||
562562
btstat == BTSTAT_LINKED_COMMAND_COMPLETED ||
563563
btstat == BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG)) {
564-
cmd->result = (DID_OK << 16) | sdstat;
565-
if (sdstat == SAM_STAT_CHECK_CONDITION && cmd->sense_buffer)
566-
cmd->result |= (DRIVER_SENSE << 24);
564+
if (sdstat == SAM_STAT_COMMAND_TERMINATED) {
565+
cmd->result = (DID_RESET << 16);
566+
} else {
567+
cmd->result = (DID_OK << 16) | sdstat;
568+
if (sdstat == SAM_STAT_CHECK_CONDITION &&
569+
cmd->sense_buffer)
570+
cmd->result |= (DRIVER_SENSE << 24);
571+
}
567572
} else
568573
switch (btstat) {
569574
case BTSTAT_SUCCESS:

0 commit comments

Comments
 (0)