scsi: storvsc: Increase the timeouts to storvsc_timeout
Subsystems (3)
Dexuan Cui
maintainerPATCH 1/1 scsi: storvsc: Increase the timeouts to storvsc_timeout
Currently storvsc_timeout is only used in storvsc_sdev_configure(), and 5s and 10s are used elsewhere. It turns out that rarely the 5s is not enough on Azure, so let's use storvsc_timeout everywhere.
In case a timeout happens and storvsc_channel_init() returns an error, close the VMBus channel so that any host-to-guest messages in the channel's ringbuffer, which might come late, can be safely ignored.
Add a "const" to storvsc_timeout.
--- drivers/scsi/storvsc_drv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/storvsc_drv.c +6 -4
@@ -362,7 +362,7 @@ MODULE_PARM_DESC(ring_avail_percent_lowater,/* * Timeout in seconds for all devices managed by this driver. */ -static int storvsc_timeout =180 ; +static const int storvsc_timeout =180 ;#if IS_ENABLED (CONFIG_SCSI_FC_ATTRS )static struct scsi_transport_template *fc_transport_template;
@@ -768,7 +768,7 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns)return ; } - t =wait_for_completion_timeout (&request->wait_event,10 *HZ ); + t =wait_for_completion_timeout (&request->wait_event, storvsc_timeout *HZ );if (t ==0 ) {dev_err (dev,"Failed to create sub-channel: timed out\n" );return ;
@@ -833,7 +833,7 @@ static int storvsc_execute_vstor_op(struct hv_device *device,if (ret !=0 )return ret; - t =wait_for_completion_timeout (&request->wait_event,5 *HZ ); + t =wait_for_completion_timeout (&request->wait_event, storvsc_timeout *HZ );if (t ==0 )return -ETIMEDOUT ;
@@ -1350,6 +1350,8 @@ static int storvsc_connect_to_vsp(struct hv_device *device, u32 ring_size,return ret; ret =storvsc_channel_init (device, is_fc); +if (ret) +vmbus_close (device->channel);return ret; }
@@ -1668,7 +1670,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)if (ret !=0 )return FAILED ; - t =wait_for_completion_timeout (&request->wait_event,5 *HZ ); + t =wait_for_completion_timeout (&request->wait_event, storvsc_timeout *HZ );if (t ==0 )return TIMEOUT_ERROR ;
Signature · 1 line
2.25.1
Quoted 6 lines
Subject: [PATCH] scsi: storvsc: Increase the timeouts to
storvsc_timeoutCurrently
storvsc_timeoutis only used instorvsc_sdev_configure(), and 5s and 10s are used elsewhere. It turns out that rarely the 5s is not enough on Azure, so let's usestorvsc_timeouteverywhere.
Quoted 8 lines
In case a timeout happens and
storvsc_channel_init()returns an error, close the VMBus channel so that any host-to-guest messages in the channel's ringbuffer, which might come late, can be safely ignored.Add a "const" to
storvsc_timeout.Signed-off-by Dexuan Cui <[email protected]>
Quoted 65 lines
--- drivers/scsi/storvsc_drv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/scsi/storvsc_drv.c index renamed from drivers/scsi/storvsc_drv.c +0
-0
2e6b2412d2c9..d9e59204a9c3100644drivers/scsi/storvsc_drv.c +2
-1@@ -362,7 +362,7 @@ MODULE_PARM_DESC(ring_avail_percent_lowater,/* * Timeout in seconds for all devices managed by this driver. */ -static int storvsc_timeout =180 ; +static const int storvsc_timeout =180 ;#if IS_ENABLED (CONFIG_SCSI_FC_ATTRS ) static struct scsi_transport_template *fc_transport_template; @@ -768,7 +768,7 @@ static void handle_multichannel_storage(struct hv_device *device,int
max_chns)drivers/scsi/storvsc_drv.c +1
-1return ; } - t =wait_for_completion_timeout (&request->wait_event,10 *HZ ); + t = wait_for_completion_timeout(&request->wait_event,
storvsc_timeoutdrivers/scsi/storvsc_drv.c +2
-1+* HZ);if (t ==0 ) {dev_err (dev,"Failed to create sub-channel: timed out\n" );return ;@@ -833,7 +833,7 @@ static int storvsc_execute_vstor_op(struct hv_device *device, if (ret != 0)return ret; - t =wait_for_completion_timeout (&request->wait_event,5 *HZ ); + t = wait_for_completion_timeout(&request->wait_event,
storvsc_timeoutdrivers/scsi/storvsc_drv.c +3
-0+* HZ);if (t ==0 )return -ETIMEDOUT ;@@ -1350,6 +1350,8 @@ static int storvsc_connect_to_vsp(struct hv_device *device, u32 ring_size, return ret; ret =storvsc_channel_init (device, is_fc); +if (ret) +vmbus_close (device->channel);return ret;}
drivers/scsi/storvsc_drv.c +1
-1@@ -1668,7 +1670,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)if (ret !=0 )return FAILED ; - t =wait_for_completion_timeout (&request->wait_event,5 *HZ ); + t = wait_for_completion_timeout(&request->wait_event,
storvsc_timeoutdrivers/scsi/storvsc_drv.c +1
-1+* HZ);if (t ==0 )return TIMEOUT_ERROR ; --2.25.1
Martin K. Petersen
AppliedQuoted 9 lines · Dexuan Cui
Currently
storvsc_timeoutis only used instorvsc_sdev_configure(), and 5s and 10s are used elsewhere. It turns out that rarely the 5s is not enough on Azure, so let's usestorvsc_timeouteverywhere.In case a timeout happens and
storvsc_channel_init()returns an error, close the VMBus channel so that any host-to-guest messages in the channel's ringbuffer, which might come late, can be safely ignored.[...]
Applied to 6.16/scsi-fixes, thanks!
[1/1] scsi: storvsc: Increase the timeouts to storvsc_timeout
https://git.kernel.org/mkp/scsi/c/b2f966568faa
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering