drivers: scsi: storvsc
Subsystems (3)
cover drivers: scsi: storvsc
The current Windows hosts only handle a subset of scsi commands sent from the guest and for commands that are not supported, they are filtered on the host side a generic failure is returned to the guest as SRB status. The returned error code does not permit the guest to figure out if there was an error or if the command was not supported.
Based on the input I got from the community, I have convinced the windows developers to return an error code that allows the guest to distinguish between unsupported command and true failures. However, it is not clear when this fix will be shipped.
This patch set addresses this issue by filtering the ATA_16 command on the guest (note that currently the host is filtering this command as it is not supported). I also have a patch here the correctly handles SRB_STATUS_INVALID_REQUEST error returns - note that the current windows hosts don't return this today.
This is a resend of the patches sent earlier based on suggestions from Jeff Garzik <[email protected]> and Douglas Gilbert <[email protected]>.
Regards,
K. Y
PATCH RESEND 1/2 Drivers: scsi: storvsc: Set the scsi result correctly when SRB status is INVALID
Currently Windows hosts only support a subset of scsi commands and for commands that are not supported, the host returns a generic SRB failure status. However, they have agreed to change the return value to indicate that the command is not supported. In preparation for that, handle the SRB_STATUS_INVALID_REQUEST return value correctly.
I would like to thank Jeff Garzik <[email protected]> and Douglas Gilbert <[email protected]> for suggesting the correct approach here.
--- drivers/scsi/storvsc_drv.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/scsi/storvsc_drv.c +12 -0
@@ -202,6 +202,7 @@ enum storvsc_request_type {#define SRB_STATUS_INVALID_LUN 0x20#define SRB_STATUS_SUCCESS 0x01#define SRB_STATUS_ERROR 0x04 +#define SRB_STATUS_INVALID_REQUEST 0x06/* * This is the end of Protocol specific defines.
@@ -779,6 +780,17 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request) }/* +* If the host returns with an invalid request, set +* the scsi command result correctly. +*/ +if (vm_srb->srb_status ==SRB_STATUS_INVALID_REQUEST ) { + scmnd->result = ((DRIVER_SENSE <<24 ) | +SAM_STAT_CHECK_CONDITION ); +scsi_build_sense_buffer (0 , scmnd->sense_buffer, +ILLEGAL_REQUEST ,0x20 ,0 ); + } + +/* * If there is an error; offline the device since all * error recovery strategies would have already been * deployed on the host side.
Signature · 1 line
1.7.4.1
PATCH RESEND 2/2 Drivers: scsi: storvsc: Don't pass ATA_16 command to the host
The current Windows hosts don't handle the ATA_16 command and furthermore return a generic error code after filtering the command on the host side. For now filter the command on the guest side until the host is modified to properly handle unsupported commands.
I would like to thank Jeff Garzik <[email protected]> and Douglas Gilbert <[email protected]> for suggesting the correct approach here.
--- drivers/scsi/storvsc_drv.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
drivers/scsi/storvsc_drv.c +13 -1
@@ -1233,9 +1233,21 @@ static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd)/* * smartd sends this command and the host does not handle * this. So, don't send it. +* The current Windows hosts implement a subset of scsi commands +* and for the commands that are not implemented, the host filters +* them and returns a generic failure SRB status. I have been in +* discussions with the Windows team to return the appropriate SRB +* status code for unsupported scsi commands and while they have +* agreed to implement this, it is not clear when this change will be +* available. Consequently, filtering the command before submitting it +* to the host is a resonable interim solution. */ case SET_WINDOW : - scmnd->result =ILLEGAL_REQUEST <<16 ; +case ATA_16 : + scmnd->result = ((DRIVER_SENSE <<24 ) | +SAM_STAT_CHECK_CONDITION ); +scsi_build_sense_buffer (0 , scmnd->sense_buffer, +ILLEGAL_REQUEST ,0x20 ,0 ); allowed = false;break ;default :
Signature · 1 line
1.7.4.1
Please drop these two patches. It looks like I sent out the wrong set of patches. I will send the ones I wanted to send shortly.
Regards,
K. Y
Quoted 34 lines
-----Original Message-----
From: K. Y. Srinivasan [mailto:[email protected]]
Sent: Sunday, March 18, 2012 4:00 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: [PATCH RESEND 0000/0002] drivers: scsi: storvscThe current Windows hosts only handle a subset of scsi commands sent from the guest and for commands that are not supported, they are filtered on the host side a generic failure is returned to the guest as SRB status. The returned error code does not permit the guest to figure out if there was an error or if the command was not supported.
Based on the input I got from the community, I have convinced the windows developers to return an error code that allows the guest to distinguish between unsupported command and true failures. However, it is not clear when this fix will
be shipped.This patch set addresses this issue by filtering the
ATA_16command on the guest (note that currently the host is filtering this command as it is not supported). I also have a patch here the correctly handlesSRB_STATUS_INVALID_REQUESTerror returns - note that the current windows hosts don't return this today.This is a resend of the patches sent earlier based on suggestions from Jeff Garzik <[email protected]> and Douglas Gilbert <[email protected]>.
Regards,
K. Y