Skip to content

Commit 4c4528e

Browse files
committed
scsi: storvsc: Increase the timeouts to storvsc_timeout
jira LE-3544 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 0c35fa3 commit 4c4528e

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
@@ -355,7 +355,7 @@ MODULE_PARM_DESC(ring_avail_percent_lowater,
355355
/*
356356
* Timeout in seconds for all devices managed by this driver.
357357
*/
358-
static int storvsc_timeout = 180;
358+
static const int storvsc_timeout = 180;
359359

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

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

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

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

13461346
ret = storvsc_channel_init(device, is_fc);
1347+
if (ret)
1348+
vmbus_close(device->channel);
13471349

13481350
return ret;
13491351
}
@@ -1664,7 +1666,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
16641666
if (ret != 0)
16651667
return FAILED;
16661668

1667-
t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
1669+
t = wait_for_completion_timeout(&request->wait_event, storvsc_timeout * HZ);
16681670
if (t == 0)
16691671
return TIMEOUT_ERROR;
16701672

0 commit comments

Comments
 (0)