summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorHou Pu <houpu@bytedance.com>2020-08-10 08:00:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-09 19:12:22 +0200
commitc756635246e9da7b6c6dcbc08b4519bdcb0d3475 (patch)
tree379a475a56389645f1d5c0e49ef4aa481df93a91 /drivers/block
parentc1e333e7b8daf2ff0df2fed638938e79909de0a4 (diff)
nbd: restore default timeout when setting it to zero
[ Upstream commit acb19e17c5134dd78668c429ecba5b481f038e6a ] If we configured io timeout of nbd0 to 100s. Later after we finished using it, we configured nbd0 again and set the io timeout to 0. We expect it would timeout after 30 seconds and keep retry. But in fact we could not change the timeout when we set it to 0. the timeout is still the original 100s. So change the timeout to default 30s when we set it to zero. It also behaves same as commit 2da22da57348 ("nbd: fix zero cmd timeout handling v2"). It becomes more important if we were reconfigure a nbd device and the io timeout it set to zero. Because it could take 30s to detect the new socket and thus io could be completed more quickly compared to 100s. Signed-off-by: Hou Pu <houpu@bytedance.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7b61d53ba050..7c577cabb9c3 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1349,6 +1349,8 @@ static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout)
nbd->tag_set.timeout = timeout * HZ;
if (timeout)
blk_queue_rq_timeout(nbd->disk->queue, timeout * HZ);
+ else
+ blk_queue_rq_timeout(nbd->disk->queue, 30 * HZ);
}
/* Must be called with config_lock held */