Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288935
b: refs/heads/master
c: 1604632
h: refs/heads/master
i:
  288933: 5821b01
  288931: 24d7deb
  288927: f050483
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Feb 9, 2012
1 parent a5e9fcc commit 85d7749
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c77b63b639f52b2e92d0bbaa94f33a78939f3e7c
refs/heads/master: 160463204f541cea112fd4d68422f297bd98ec51
21 changes: 16 additions & 5 deletions trunk/drivers/staging/hv/storvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ enum storvsc_request_type {
UNKNOWN_TYPE,
};

/*
* SRB status codes and masks; a subset of the codes used here.
*/

#define SRB_STATUS_AUTOSENSE_VALID 0x80
#define SRB_STATUS_INVALID_LUN 0x20
#define SRB_STATUS_SUCCESS 0x01
#define SRB_STATUS_ERROR 0x04



struct hv_storvsc_request {
struct hv_device *device;
Expand Down Expand Up @@ -561,7 +571,7 @@ static void storvsc_on_io_completion(struct hv_device *device,
if ((stor_pkt->vm_srb.cdb[0] == INQUIRY) ||
(stor_pkt->vm_srb.cdb[0] == MODE_SENSE)) {
vstor_packet->vm_srb.scsi_status = 0;
vstor_packet->vm_srb.srb_status = 0x1;
vstor_packet->vm_srb.srb_status = SRB_STATUS_SUCCESS;
}


Expand All @@ -572,7 +582,7 @@ static void storvsc_on_io_completion(struct hv_device *device,
vstor_packet->vm_srb.sense_info_length;

if (vstor_packet->vm_srb.scsi_status != 0 ||
vstor_packet->vm_srb.srb_status != 1){
vstor_packet->vm_srb.srb_status != SRB_STATUS_SUCCESS){
dev_warn(&device->device,
"cmd 0x%x scsi status 0x%x srb status 0x%x\n",
stor_pkt->vm_srb.cdb[0],
Expand All @@ -582,7 +592,8 @@ static void storvsc_on_io_completion(struct hv_device *device,

if ((vstor_packet->vm_srb.scsi_status & 0xFF) == 0x02) {
/* CHECK_CONDITION */
if (vstor_packet->vm_srb.srb_status & 0x80) {
if (vstor_packet->vm_srb.srb_status &
SRB_STATUS_AUTOSENSE_VALID) {
/* autosense data available */
dev_warn(&device->device,
"stor pkt %p autosense data valid - len %d\n",
Expand Down Expand Up @@ -1191,15 +1202,15 @@ static void storvsc_command_completion(struct hv_storvsc_request *request)
* error recovery strategies would have already been
* deployed on the host side.
*/
if (vm_srb->srb_status == 0x4)
if (vm_srb->srb_status == SRB_STATUS_ERROR)
scmnd->result = DID_TARGET_FAILURE << 16;
else
scmnd->result = vm_srb->scsi_status;

/*
* If the LUN is invalid; remove the device.
*/
if (vm_srb->srb_status == 0x20) {
if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) {
struct storvsc_device *stor_dev;
struct hv_device *dev = host_dev->dev;
struct Scsi_Host *host;
Expand Down

0 comments on commit 85d7749

Please sign in to comment.