Skip to contentSkip to conversation

Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

PATCH In review K. Y. Srinivasan 4 participants 12 messages Mar 2, 2012 – Mar 15, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

---
 drivers/scsi/storvsc_drv.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/storvsc_drv.c +2 -0
index 44c7a48..1404c9b 100644
@@ -1221,8 +1221,10 @@ 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.
+	 * Host also does not support ATA_16 command.
 	 */
 	case SET_WINDOW:
+	case ATA_16:
 		scmnd->result = ILLEGAL_REQUEST << 16;
 		allowed = false;
 		break;
Signature · 1 line
1.7.4.1
#2 lore raw
Quoted 15 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, March 02, 2012 4:14 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 2 lines · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

Quoted 7 lines
Quoted 5 lines
---
 drivers/scsi/storvsc_drv.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Should this go to older kernel versions as well?

I think it should. Do you want me to resend this patch with the correct tag? Also, given that storvsc has changed so much over the last several months, this patch may or may not apply to earlier versions of this driver even though this patch itself is quite trivial.

Regards,

K. Y

#3 lore raw
Quoted 21 lines · KY Srinivasan
Quoted 21 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, March 02, 2012 4:14 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 7 lines · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

---
 drivers/scsi/storvsc_drv.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Quoted 6 lines
Quoted 1 line

Should this go to older kernel versions as well?

I think it should. Do you want me to resend this patch with the correct tag? Also, given that storvsc has changed so much over the last several months, this patch may or may not apply to earlier versions of this driver even though this patch itself is quite trivial.

I'll tag it for the stable tree, then when it doesn't apply, you will get an email saying it didn't, so you can then send me the correct one :)

thanks,

greg k-h

#4 lore raw
Quoted 37 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, March 02, 2012 4:31 PM
To: KY Srinivasan
Cc: [email protected]; Haiyang Zhang; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 12 lines · KY Srinivasan
Quoted 12 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, March 02, 2012 4:14 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 2 lines
Quoted 2 lines · K. Y. Srinivasan
Quoted 1 line

Windows hosts don't handle the ATA_16 command; don't pass it to the

host.

Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
---
 drivers/scsi/storvsc_drv.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Should this go to older kernel versions as well?

Quoted 8 lines
Quoted 4 lines

I think it should. Do you want me to resend this patch with the correct tag? Also, given that storvsc has changed so much over the last several months, this patch may or may not apply to earlier versions of this driver even though this patch itself is quite trivial.

I'll tag it for the stable tree, then when it doesn't apply, you will get an email saying it didn't, so you can then send me the correct one :)

Thanks Greg.

K. Y

#5 lore raw
In reply to K. Y. Srinivasan
Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

Most devices don't handle it, and answer with and unsupported opcode sense reason. If hyperv iis buggy enough to crap out on it please add a comment explaining that.

maintainer
#10 lore raw
In reply to K. Y. Srinivasan
Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

What do you mean by this? Most SCSI devices don't handle ATA_16 because it's only useful if the device is actually an ATA device behind a bridge.

As a general rule, you shouldn't filter in the driver commands you think the host won't want to see, you should let the host reply with an error code. You should *only* filter commands that cause an actual bug in the host. Is the latter the case for this command (if so that needs to be explained)?

Quoted 2 lines

This signoff chain doesn't make sense, since you're sending me the patch and apparently you authored it.

James

#6 lore raw
In reply to Christoph Hellwig
Quoted 13 lines

-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Sunday, March 04, 2012 4:12 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 6 lines
Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

Most devices don't handle it, and answer with and unsupported opcode sense reason. If hyperv iis buggy enough to crap out on it please add a comment explaining that.

The host does not "crap out", it does return an error code but it is not "unsupported opcode". The sense reason that comes back is a generic error SRB_STATUS code. It is easier for me to filter the command on the outgoing side as opposed to dealing with a generic error code that is coming back from the host.

Regards,

K. Y

maintainer
#7 lore raw
Quoted 15 lines · KY Srinivasan
Quoted 15 lines

-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Sunday, March 04, 2012 4:12 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

Quoted 8 lines
Quoted 3 lines

Most devices don't handle it, and answer with and unsupported opcode sense reason. If hyperv iis buggy enough to crap out on it please add a comment explaining that.

The host does not "crap out", it does return an error code but it is not "unsupported opcode". The sense reason that comes back is a generic error SRB_STATUS code. It is easier for me to filter the command on the outgoing side as opposed to dealing with a generic error code that is coming back from the host.

That's the wrong thing to do ... you need to unwrap the error code. The reason being I presume it's not impossible for Windows to host a device supporting ATA_16 and there are signs that this is going to be necessary to prevent data corruption on some USB devices ... if you just filter the command without checking if the host supports it, you're going to end up perpetuating the corruption problem.

The general rule of thumb for avoiding this is to let the lower layers handle as much as possible, and only begin behaviour alterations in the upper layers if the lower layers have a provable and usually fatal failure.

James

#11 lore raw
In reply to James Bottomley
Quoted 19 lines

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, March 04, 2012 9:20 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the host.

What do you mean by this? Most SCSI devices don't handle ATA_16 because it's only useful if the device is actually an ATA device behind a bridge.

Quoted 5 lines

As a general rule, you shouldn't filter in the driver commands you think the host won't want to see, you should let the host reply with an error code. You should *only* filter commands that cause an actual bug in the host. Is the latter the case for this command (if so that needs to be explained)?

As I explained in my email to Christoph, the Windows host returns error codes that
I cannot properly decode as being "unsupported opcode". Let me investigate a little more and see if I can properly analyze the failure and return the correct error code up. If the error code I get back from Windows is such that I cannot deduce the cause of the failure, then apart from filtering the commands in the outgoing path, I am not sure what my options are.

Quoted 6 lines
Quoted 3 lines

This signoff chain doesn't make sense, since you're sending me the patch and apparently you authored it.

Good point. Since I came to MSFT, this has been the practice here - all the patches were reviewed and "signed-off" by all the relevant developers independent of the authorship and Greg seemed ok with it and has been ascribing ownership based on the person sending the patch who is always the author of the patch. How would you recommend we change this practice.

Regards,

K. Y

#8 lore raw
In reply to James Bottomley
Quoted 36 lines

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, March 04, 2012 9:49 AM
To: KY Srinivasan
Cc: Christoph Hellwig; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: RE: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 7 lines · KY Srinivasan
Quoted 7 lines

-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Sunday, March 04, 2012 4:12 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected];

[email protected];

Quoted 7 lines
Quoted 7 lines

[email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the

host.

Quoted 6 lines
Quoted 4 lines

Most devices don't handle it, and answer with and unsupported opcode sense reason. If hyperv iis buggy enough to crap out on it please add a comment explaining that.

The host does not "crap out", it does return an error code but it is not

Quoted 8 lines

"unsupported opcode".

Quoted 1 line

The sense reason that comes back is a generic error SRB_STATUS code. It is

easier for me to filter the

Quoted 1 line

command on the outgoing side as opposed to dealing with a generic error code

that is coming back from

Quoted 1 line

the host.

That's the wrong thing to do ... you need to unwrap the error code.

I will see if this is even possible based on the current error codes I get back.

Quoted 5 lines

The reason being I presume it's not impossible for Windows to host a device supporting ATA_16 and there are signs that this is going to be necessary to prevent data corruption on some USB devices ... if you just filter the command without checking if the host supports it, you're going to end up perpetuating the corruption problem.

We are talking of virtual block devices exposed to Linux guests running on a Windows hosts. I don't think they will ever need to support ATA_16 command on these virtual block devices. I will however confirm with the Windows team.

Regards,

K. Y

#9 lore raw
In reply to James Bottomley
Quoted 41 lines

-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Sunday, March 04, 2012 9:49 AM
To: KY Srinivasan
Cc: Christoph Hellwig; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: RE: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 7 lines · KY Srinivasan
Quoted 7 lines

-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Sunday, March 04, 2012 4:12 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected];

[email protected];

Quoted 7 lines
Quoted 7 lines

[email protected]; [email protected]; [email protected]; Haiyang Zhang
Subject: Re: [PATCH 1/1] Drivers: scsi: storvsc: Don't pass ATA_16 command to the host

Quoted 1 line · K. Y. Srinivasan

Windows hosts don't handle the ATA_16 command; don't pass it to the

host.

Quoted 6 lines
Quoted 4 lines

Most devices don't handle it, and answer with and unsupported opcode sense reason. If hyperv iis buggy enough to crap out on it please add a comment explaining that.

The host does not "crap out", it does return an error code but it is not

"unsupported opcode".

Quoted 1 line

The sense reason that comes back is a generic error SRB_STATUS code. It is

easier for me to filter the

Quoted 1 line

command on the outgoing side as opposed to dealing with a generic error code

that is coming back from

Quoted 8 lines
Quoted 1 line

the host.

That's the wrong thing to do ... you need to unwrap the error code. The reason being I presume it's not impossible for Windows to host a device supporting ATA_16 and there are signs that this is going to be necessary to prevent data corruption on some USB devices ... if you just filter the command without checking if the host supports it, you're going to end up perpetuating the corruption problem.

James,

Currently, the Windows host does not provide me with granular error codes to distinguish between the case where the operation failed and the case where it is an illegal or unsupported operation. I have asked the windows team to return more appropriate error codes and they may do that sometime soon. In the interim, filtering the command on the outgoing path is the best way I can deal with this issue. Currently, even on the host side they are filtering this command, except they are returning a failure to the guest instead of a more appropriate error code.
While my proposal has been accepted for windows 8, I don't know when this change will ship. Also, it is not clear when prior versions of Windows hosts that we care about will pick up this change. This patch is the only way I know how to deal with this problems within my current constraints.

Regards,

K. Y

Quoted 9 lines

The general rule of thumb for avoiding this is to let the lower layers handle as much as possible, and only begin behaviour alterations in the upper layers if the lower layers have a provable and usually fatal failure.

James