summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2011-10-10 09:37:39 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-10 22:50:00 -0600
commit92ae4ebdaa6d6d083a53421715e5cdc70ab5823e (patch)
tree08171c23d7c8884cb136182dce272f6a54baf9e1 /drivers
parente2bb65378385a10e21612845e33cd5936e0cbadb (diff)
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> Acked-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/hv/storvsc_drv.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 807c94d711c7..e41271632609 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -1122,6 +1122,22 @@ static void storvsc_command_completion(struct hv_storvsc_request *request)
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(struct scsi_cmnd *scmnd,
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) {