Skip to contentSkip to conversation

staging: hv: storvsc: ignore SET_WINDOW scsi command

PATCH In review Olaf Hering 2 participants 2 messages Oct 10, 2011

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

PATCH 1/1 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.

---
 drivers/staging/hv/storvsc_drv.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/staging/hv/storvsc_drv.c +20 -0
@@ -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 on v1 1/1
#1 lore raw
Quoted 45 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Monday, October 10, 2011 3:38 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; 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.

---
 drivers/staging/hv/storvsc_drv.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/staging/hv/storvsc_drv.c +16 -0
@@ -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

drivers/staging/hv/storvsc_drv.c static int storvsc_queuecommand_lck(stru · line 1166

Quoted 10 lines
drivers/staging/hv/storvsc_drv.c +4 -0
@@ -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) {

Regards,

K. Y