public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	ohering@suse.com, jbottomley@parallels.com, hch@infradead.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 2/2] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host
Date: Sat, 17 Mar 2012 19:55:40 +0100	[thread overview]
Message-ID: <4F64DE2C.1030809@interlog.com> (raw)
In-Reply-To: <4F64A80C.6040206@garzik.org>

On 12-03-17 04:04 PM, Jeff Garzik wrote:
> On 03/16/2012 04:24 PM, K. Y. Srinivasan wrote:
>> 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.
>>
>> Signed-off-by: K. Y. Srinivasan<kys@microsoft.com>
>> Reviewed-by: Haiyang Zhang<haiyangz@microsoft.com>
>> ---
>> drivers/scsi/storvsc_drv.c | 9 +++++++++
>> 1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
>> index 8b967c9..783bab8 100644
>> --- a/drivers/scsi/storvsc_drv.c
>> +++ b/drivers/scsi/storvsc_drv.c
>> @@ -1229,8 +1229,17 @@ 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:
>> + case ATA_16:
>> scmnd->result = ILLEGAL_REQUEST<< 16;
>> allowed = false;
>
> It would be even nicer to fill out a nice SCSI status for this. For an illegal
> request such as this, the libata SCSI simulator (drivers/ata/libata-scsi.c) uses
> a more complete sense buffer setup,
>
> static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk,
> u8 asc, u8 ascq)
> {
> cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
>
> scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
> }
>
> and calls this function for invalid/unknown/unsupported command ops thusly,
>
> ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, 0x20, 0x0);
> /* "Invalid command operation code" */
>
> Supplying asc/ascq provides additional information that may be useful in
> determining whether or not to retry, provide better error diagnostics, etc.
>
> The asc/ascq values are found in the SCSI standards documents.

Jeff,
I agree with your suggestion and would point out that the
originally proposed:
     scmnd->result = ILLEGAL_REQUEST<<  16;

is just plain wrong. result[23:16] is a Linux invented host byte
code (they typically start with "DID_") while ILLEGAL_REQUEST is
a SCSI sense key.

Doug Gilbert


  reply	other threads:[~2012-03-17 18:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16 20:24 [PATCH 0000/0002] drivers: scsi: storvsc K. Y. Srinivasan
2012-03-16 20:24 ` [PATCH 1/2] Drivers: scsi: storvsc: Set the scsi result correctly when SRB status is INVALID K. Y. Srinivasan
2012-03-16 20:24   ` [PATCH 2/2] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host K. Y. Srinivasan
2012-03-17 15:04     ` Jeff Garzik
2012-03-17 18:55       ` Douglas Gilbert [this message]
2012-03-18  1:40         ` KY Srinivasan
2012-03-16 20:36   ` [PATCH 1/2] Drivers: scsi: storvsc: Set the scsi result correctly when SRB status is INVALID Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F64DE2C.1030809@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=jeff@garzik.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ohering@suse.com \
    --cc=virtualization@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox