Skip to content

Commit 31d6b1e

Browse files
committed
scsi: storvsc: Increase the timeouts to storvsc_timeout
jira LE-3546 commit-author Dexuan Cui <[email protected]> commit b2f9665 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. Cc: [email protected] Signed-off-by: Dexuan Cui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Long Li <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> (cherry picked from commit b2f9665) Signed-off-by: Sultan Alsawaf <[email protected]>
1 parent 1d009c1 commit 31d6b1e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/scsi/storvsc_drv.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ MODULE_PARM_DESC(ring_avail_percent_lowater,
356356
/*
357357
* Timeout in seconds for all devices managed by this driver.
358358
*/
359-
static int storvsc_timeout = 180;
359+
static const int storvsc_timeout = 180;
360360

361361
#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
362362
static struct scsi_transport_template *fc_transport_template;
@@ -762,7 +762,7 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns)
762762
return;
763763
}
764764

765-
t = wait_for_completion_timeout(&request->wait_event, 10*HZ);
765+
t = wait_for_completion_timeout(&request->wait_event, storvsc_timeout * HZ);
766766
if (t == 0) {
767767
dev_err(dev, "Failed to create sub-channel: timed out\n");
768768
return;
@@ -827,7 +827,7 @@ static int storvsc_execute_vstor_op(struct hv_device *device,
827827
if (ret != 0)
828828
return ret;
829829

830-
t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
830+
t = wait_for_completion_timeout(&request->wait_event, storvsc_timeout * HZ);
831831
if (t == 0)
832832
return -ETIMEDOUT;
833833

@@ -1345,6 +1345,8 @@ static int storvsc_connect_to_vsp(struct hv_device *device, u32 ring_size,
13451345
return ret;
13461346

13471347
ret = storvsc_channel_init(device, is_fc);
1348+
if (ret)
1349+
vmbus_close(device->channel);
13481350

13491351
return ret;
13501352
}
@@ -1662,7 +1664,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
16621664
if (ret != 0)
16631665
return FAILED;
16641666

1665-
t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
1667+
t = wait_for_completion_timeout(&request->wait_event, storvsc_timeout * HZ);
16661668
if (t == 0)
16671669
return TIMEOUT_ERROR;
16681670

0 commit comments

Comments
 (0)