Skip to contentSkip to conversation

storvsc: use default I/O timeout handler for FC devices

PATCH Superseded Long Li 4 participants 4 messages Jun 13, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Long Li

author
#0 lore raw

PATCH 1/1 storvsc: use default I/O timeout handler for FC devices

From: Long Li <[email protected]>

FC disks are usually setup in a multipath system, and they don't want to unconditionaly reset I/O on timeout. I/O timeout is detected by multipath as a good time to failover and recover.

---
 drivers/scsi/storvsc_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/scsi/storvsc_drv.c +7 -0
index 8d955db..d60b5ea 100644
@@ -486,6 +486,7 @@ struct hv_host_device {
 	unsigned int port;
 	unsigned char path;
 	unsigned char target;
+	bool is_fc;
 };
 
 struct storvsc_scan_work {
@@ -1495,6 +1496,11 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
  */
 static enum blk_eh_timer_return storvsc_eh_timed_out(struct scsi_cmnd *scmnd)
 {
+	struct hv_host_device *host_dev = shost_priv(scmnd->device->host);
+
+	if (host_dev->is_fc)
+		return BLK_EH_NOT_HANDLED;
+
 	return BLK_EH_RESET_TIMER;
 }
 
@@ -1738,6 +1744,7 @@ static int storvsc_probe(struct hv_device *device,
 
 	host_dev->port = host->host_no;
 	host_dev->dev = device;
+	host_dev->is_fc = is_fc;
 
 
 	stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Long Li

From: Long Li <[email protected]>

FC disks are usually setup in a multipath system, and they don't want to unconditionaly reset I/O on timeout. I/O timeout is detected by multipath as a good time to failover and recover.

---

Looks good,

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#2 lore raw
In reply to Long Li
Quoted 36 lines · Long Li

From: Long Li <[email protected]>

FC disks are usually setup in a multipath system, and they don't want to unconditionaly reset I/O on timeout. I/O timeout is detected by multipath as a good time to failover and recover.

---
 drivers/scsi/storvsc_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/scsi/storvsc_drv.c +6 -0
index 8d955db..d60b5ea 100644
@@ -486,6 +486,7 @@ struct hv_host_device {
 	unsigned int port;
 	unsigned char path;
 	unsigned char target;
+	bool is_fc;
 };
 
 struct storvsc_scan_work {
@@ -1495,6 +1496,11 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
  */
 static enum blk_eh_timer_return storvsc_eh_timed_out(struct scsi_cmnd *scmnd)
 {
+	struct hv_host_device *host_dev = shost_priv(scmnd->device->host);
+
+	if (host_dev->is_fc)
+		return BLK_EH_NOT_HANDLED;
+
 	return BLK_EH_RESET_TIMER;
 }
 

drivers/scsi/storvsc_drv.c static int storvsc_probe(struct hv_device *device, · line 1750

Quoted 7 lines
drivers/scsi/storvsc_drv.c +1 -0
@@ -1738,6 +1744,7 @@ static int storvsc_probe(struct hv_device *device,
 
 	host_dev->port = host->host_no;
 	host_dev->dev = device;
+	host_dev->is_fc = is_fc;
 
 
 	stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);

Hello Long,

As far as I know there is no other SCSI driver nor block driver in the Linux kernel tree that returns BLK_EH_RESET_TIMER unconditionally. Would a valid alternative fix be to remove storvsc_eh_timed_out() entirely? If not, what would break if that function would be removed entirely?

Additionally, for FC, shouldn't that timeout handler handle the "port blocked" state? Shouldn't fc_eh_timed_out() be used for FC instead of just returning BLK_EH_NOT_HANDLED?

Thanks,

Bart.

#3 lore raw
Quoted 58 lines

-----Original Message-----
From: Bart Van Assche [mailto:[email protected]]
Sent: Tuesday, June 13, 2017 8:38 AM
To: [email protected]; KY Srinivasan <[email protected]>; [email protected]; [email protected]; Stephen Hemminger <[email protected]>; Long Li <[email protected]>; [email protected]; Haiyang Zhang <[email protected]>
Cc: [email protected]; Long Li <[email protected]>
Subject: Re: [Possible Phish Fraud][PATCH] storvsc: use default I/O timeout handler for FC devices

drivers/scsi/storvsc_drv.c static int storvsc_host_reset_handler(struct

Quoted 24 lines · Long Li

From: Long Li <[email protected]>

FC disks are usually setup in a multipath system, and they don't want to unconditionaly reset I/O on timeout. I/O timeout is detected by multipath as a good time to failover and recover.

---
 drivers/scsi/storvsc_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/scsi/storvsc_drv.c +1 -0
index 8d955db..d60b5ea 100644
@@ -486,6 +486,7 @@ struct hv_host_device {
 	unsigned int port;
 	unsigned char path;
 	unsigned char target;
+	bool is_fc;
 };
 
 struct storvsc_scan_work {
@@ -1495,6 +1496,11 @@ static int storvsc_host_reset_handler(struct

scsi_cmnd *scmnd)

Quoted 19 lines
drivers/scsi/storvsc_drv.c +6 -0
  */
 static enum blk_eh_timer_return storvsc_eh_timed_out(struct scsi_cmnd
 *scmnd)  {
+	struct hv_host_device *host_dev = shost_priv(scmnd->device->host);
+
+	if (host_dev->is_fc)
+		return BLK_EH_NOT_HANDLED;
+
 	return BLK_EH_RESET_TIMER;
 }
 
@@ -1738,6 +1744,7 @@ static int storvsc_probe(struct hv_device
 *device,
 
 	host_dev->port = host->host_no;
 	host_dev->dev = device;
+	host_dev->is_fc = is_fc;
 
 
Quoted 8 lines
Quoted 1 line

stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);

Hello Long,

As far as I know there is no other SCSI driver nor block driver in the Linux kernel tree that returns BLK_EH_RESET_TIMER unconditionally. Would a valid alternative fix be to remove storvsc_eh_timed_out() entirely? If not, what would break if that function would be removed entirely?

Storvsc handles virtualized devices for Hyper-V and Azure. The host decides on how to handle I/O timeout, and makes decision based on how long I/O has been in flight. This is why we use BLK_EH_RESET_TIMER and leave the I/O timeout handling to the host for most cases.

Quoted 4 lines

Additionally, for FC, shouldn't that timeout handler handle the "port blocked" state? Shouldn't fc_eh_timed_out() be used for FC instead of just returning BLK_EH_NOT_HANDLED?

I agree with you. Storvsc didn't expose rport state. But this has changed with a recent commit daf0cd445a218314f9461d67d4f2b9c24cdd534b. I'll send a V2 to address this.

Thank you

Long

Quoted 4 lines

Thanks,

Bart.