Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1052230pxk; Mon, 31 Aug 2020 08:31:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEWe+0qLp072dx7YN3bti/zdWWakvQJxdbK1bg27oVYR1e1cjroADup7RPDmVEzofLdeww X-Received: by 2002:a50:fe07:: with SMTP id f7mr739129edt.173.1598887918522; Mon, 31 Aug 2020 08:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598887918; cv=none; d=google.com; s=arc-20160816; b=SsTIzmWSxg3CvXrHcTK6A1n0u30lINyHRkn/B1EGmBkAukR9WEFYn5PnMWtzOrrdAG M0DGL+LKdDI4d2M7oghr2Nldo4wEdgr+DqqlEpGj6mmwke9RjdnrZ3opAT4q9oYkyfn9 1/jhCF+l4ty6AXCm2pT3BOrE3mgRv54DC4VFuH7MVGlsvezd+dKA6M9ABIw2BNqsW7/v uGLqXy97wmi1yTLGVJN29TAPv68h1GvUhCcbQ0GTmIZettZLHJHWvtBodPftaZldGHlx 29UaNPR1yDYT78/tOVXNPiduw71cqFl3q5EYF7p5pTJUU2uzTg21l/4DDJUPoXGRKbyV bqiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H258/RjSPIftnkxF4ghF5RPmrN2WtU+3zEF0CmBPCVQ=; b=gMNm3TFKdRyCFQxnuLHM7BerP3Zm0cB9COnnCL50IFfAcK7kz5iW2/964UHrg0CnOk lVx9j8+gr5hDad4aTM6n77l7u+gS85e2leAG1mJuv8PIOq4hCGsFh9J6I/rfHDxHGzKz 404Jd+UUNwudxIXO54DYH3io9hf9AiTToUoHyzoXo4E3GRo82SK8GL9xsOOCfC1sMbSh xAxFRuLc48UD3ipZUcTbAqxF6X2Dnl4Z277fU23kw8Rm0eatGQNAb/aDyM9uzzd+aKwr 9GhCtJxUTkrcQ7DXnp4jn4BLSN/zHtke8ePOPsP4NuRl7SrR+iQ93oXQssIV2uqr403s MRvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AP7mPhhI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q14si6299783ejb.72.2020.08.31.08.31.35; Mon, 31 Aug 2020 08:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AP7mPhhI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728665AbgHaPad (ORCPT + 99 others); Mon, 31 Aug 2020 11:30:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:39660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728584AbgHaPaV (ORCPT ); Mon, 31 Aug 2020 11:30:21 -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 DA7E920767; Mon, 31 Aug 2020 15:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887820; bh=ht+MpGssPKdJ6E3rsvdmycBCNz+RMWwRINpMqFlTCqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AP7mPhhIXZomj4o2XoZnzCtfT9p7rI3/XsbrLq4uRX2koZd2g6tmndwdD17I4amDm r7DiKc8GM6BVTEa6SN9P9tvgxcoxPzfkn8Jv65muM0505aw+oeawBfBrLghgjqiTLs GV2M1zDmJXoiE9i3nslbAFVYbjn5Jski6rNMo4RE= 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.8 31/42] nbd: restore default timeout when setting it to zero Date: Mon, 31 Aug 2020 11:29:23 -0400 Message-Id: <20200831152934.1023912-31-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831152934.1023912-1-sashal@kernel.org> References: <20200831152934.1023912-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 ce7e9f223b20b..bc9dc1f847e19 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1360,6 +1360,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