From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 264CEC433E2 for ; Mon, 31 Aug 2020 15:31:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F22BD214DB for ; Mon, 31 Aug 2020 15:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887872; bh=jgGMZKTpMuWZUCumUs3Zf/xRhs6V9jg+7yCewR8BJWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t0rETtOtDWJvkxWluTeys9oPDCwMjSte6Gf0amiYzsRVV+RbXnESowAmXxSBYqD6B BkMwbi1NFDdm6DTdYHIjuHyu2trCvllsRap+XbsQOh5q3frCaG5dkQe+076nf6l/aM gRPgaWNd7p4wiFzUuwZy3nsfnbgRuQZ/6ddX0uRA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728812AbgHaPbK (ORCPT ); Mon, 31 Aug 2020 11:31:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:41482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728795AbgHaPbG (ORCPT ); Mon, 31 Aug 2020 11:31:06 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6B972151B; Mon, 31 Aug 2020 15:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887865; bh=jgGMZKTpMuWZUCumUs3Zf/xRhs6V9jg+7yCewR8BJWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VTb4HRMkVv/CU5czHugWpdQuA/skqeWA+EXheRWa2I20FqzUO6nepn2QaHnVg14Ng XpMukZkPpbFAnSl7uK9CXD0xqCez0te2vSAY9Y8H/2/4NSt8WHz9GhShp3q3xwDmC7 qKHcoXcDbZ0BFk7B3sXCpiNMIC7YO9AeQ9bf/R4I= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hou Pu , Josef Bacik , Jens Axboe , Sasha Levin , linux-block@vger.kernel.org, nbd@other.debian.org Subject: [PATCH AUTOSEL 5.4 16/23] nbd: restore default timeout when setting it to zero Date: Mon, 31 Aug 2020 11:30:32 -0400 Message-Id: <20200831153039.1024302-16-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831153039.1024302-1-sashal@kernel.org> References: <20200831153039.1024302-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hou Pu [ 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 Reviewed-by: Josef Bacik Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/nbd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 7b61d53ba050e..7c577cabb9c3b 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 */ -- 2.25.1