* [PATCH] staging: hv: storvsc: ignore SET_WINDOW scsi command
@ 2011-10-10 7:37 Olaf Hering
2011-10-10 13:53 ` KY Srinivasan
0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2011-10-10 7:37 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang
Some commands sent by smartd will offline the device.
With this change applied, smartd sill not monitor the device anymore.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
drivers/staging/hv/storvsc_drv.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -1122,6 +1122,22 @@ static void storvsc_command_completion(s
kmem_cache_free(host_dev->request_pool, cmd_request);
}
+static bool storvsc_check_scsi_cmd(struct scsi_cmnd *scmnd)
+{
+ bool allowed = true;
+ u8 scsi_op = scmnd->cmnd[0];
+
+ switch (scsi_op) {
+ /* smartd sends this command, which will offline the device */
+ case SET_WINDOW:
+ scmnd->result = DID_ERROR << 16;
+ allowed = false;
+ break;
+ default:
+ break;
+ }
+ return allowed;
+}
/*
* storvsc_queuecommand - Initiate command processing
@@ -1141,6 +1157,10 @@ static int storvsc_queuecommand_lck(stru
unsigned int sg_count = 0;
struct vmscsi_request *vm_srb;
+ if (storvsc_check_scsi_cmd(scmnd) == false) {
+ done(scmnd);
+ return 0;
+ }
/* If retrying, no need to prep the cmd */
if (scmnd->host_scribble) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] staging: hv: storvsc: ignore SET_WINDOW scsi command
2011-10-10 7:37 [PATCH] staging: hv: storvsc: ignore SET_WINDOW scsi command Olaf Hering
@ 2011-10-10 13:53 ` KY Srinivasan
0 siblings, 0 replies; 2+ messages in thread
From: KY Srinivasan @ 2011-10-10 13:53 UTC (permalink / raw)
To: Olaf Hering; +Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1815 bytes --]
> -----Original Message-----
> From: Olaf Hering [mailto:olaf@aepfle.de]
> Sent: Monday, October 10, 2011 3:38 AM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang
> Subject: [PATCH] staging: hv: storvsc: ignore SET_WINDOW scsi command
>
> Some commands sent by smartd will offline the device.
> With this change applied, smartd sill not monitor the device anymore.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
>
> ---
> drivers/staging/hv/storvsc_drv.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> --- a/drivers/staging/hv/storvsc_drv.c
> +++ b/drivers/staging/hv/storvsc_drv.c
> @@ -1122,6 +1122,22 @@ static void storvsc_command_completion(s
> kmem_cache_free(host_dev->request_pool, cmd_request);
> }
>
> +static bool storvsc_check_scsi_cmd(struct scsi_cmnd *scmnd)
> +{
> + bool allowed = true;
> + u8 scsi_op = scmnd->cmnd[0];
> +
> + switch (scsi_op) {
> + /* smartd sends this command, which will offline the device */
> + case SET_WINDOW:
> + scmnd->result = DID_ERROR << 16;
> + allowed = false;
> + break;
> + default:
> + break;
> + }
> + return allowed;
> +}
>
> /*
> * storvsc_queuecommand - Initiate command processing
> @@ -1141,6 +1157,10 @@ static int storvsc_queuecommand_lck(stru
> unsigned int sg_count = 0;
> struct vmscsi_request *vm_srb;
>
> + if (storvsc_check_scsi_cmd(scmnd) == false) {
> + done(scmnd);
> + return 0;
> + }
>
> /* If retrying, no need to prep the cmd */
> if (scmnd->host_scribble) {
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Regards,
K. Y
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-10 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-10 7:37 [PATCH] staging: hv: storvsc: ignore SET_WINDOW scsi command Olaf Hering
2011-10-10 13:53 ` KY Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).