Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp228749ybi; Fri, 24 May 2019 02:57:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4XksduIO35CBjjKaGo44hU2NbEd1YWkReZMi6NJRvOK2rIiXVG+Bf+ZfBH7m8qJQAiAIv X-Received: by 2002:a17:90a:2a85:: with SMTP id j5mr7929029pjd.107.1558691866260; Fri, 24 May 2019 02:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558691866; cv=none; d=google.com; s=arc-20160816; b=NdVziJcdGPIgjwRfFTGXimRWwf9u+8E5cUcipUjO6k0M/CQl6oaJCJE2+UTuvMcERb Ya1RVeyCk6WeMKVPHDrez9zSKwsjLF4/nCSSMwu7mbBD35uraqAcBtHgPQTaFRwdf0sk xc2YIpeyXpvLjOy1DV3s/561YltSaCzdr7NTYZIUohSe2W+GHef4Nbr0MvJwxoNzXJkt Dyyqy4zu8vL8760ShcCtBAqmSNUa/RxuQTld0+T03+a0BXmtP4oJMK39uYljrfGNX9Mo RPeb7lXbZ2J1xkWiODeywnMsopMuhEyqTpl9kXC5rGJt1bHNe6SRdc65J7ubEttz0dkI 1zQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=x39C5zM1XGbQJTI/RlZCYWln9tEuNX2pUjHJ3MSmrQg=; b=msSoNl8s3BQyRSZKmsSmXQnMMAhUWlv3YscvYeoBED5MocMFJsRJ/1RS0t5Yx8rV56 Aa7hk9JHuzJcGYkHx3Ug46AWsJw8qe6WgMGya9BQrFPihe2geAwGXshf7ZKtlTWbPRVi HGdnlGLXYdhES8WfBF42kAFosf+UEVwkjNozewSrLB90rc+h2WjA7pWWAWibSrkrxERW /sCgsOByTC60/mIU89U0t+VlrZiSaffgiOjE1Wdkf2MijNwLPN596X8jkXUdNqRoRotY glxOrEu/XaXpNaXdttSN3FdUSxA+cgAYCoeXZRjLnR3vFQWBbspGfbhsycOFwk+58l5A AxVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p88si2901941pjp.3.2019.05.24.02.57.28; Fri, 24 May 2019 02:57:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390229AbfEXJzo (ORCPT + 99 others); Fri, 24 May 2019 05:55:44 -0400 Received: from m9784.mail.qiye.163.com ([220.181.97.84]:30532 "EHLO m9784.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389911AbfEXJzn (ORCPT ); Fri, 24 May 2019 05:55:43 -0400 X-Greylist: delayed 458 seconds by postgrey-1.27 at vger.kernel.org; Fri, 24 May 2019 05:55:42 EDT Received: from kernel_test2.localdomain (unknown [120.132.1.243]) by m9784.mail.qiye.163.com (Hmail) with ESMTPA id 1AA2E41CAB; Fri, 24 May 2019 17:48:52 +0800 (CST) From: Yao Liu To: Josef Bacik , Jens Axboe Cc: linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] nbd: mark sock as dead even if it's the last one Date: Fri, 24 May 2019 17:43:56 +0800 Message-Id: <1558691036-16281-3-git-send-email-yotta.liu@ucloud.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558691036-16281-1-git-send-email-yotta.liu@ucloud.cn> References: <1558691036-16281-1-git-send-email-yotta.liu@ucloud.cn> X-HM-Spam-Status: e1kIGBQJHllBWVZKVUpLSUJCQkNLTU9LT0pKWVdZKFlBSUI3V1ktWUFJV1 kJDhceCFlBWTU0KTY6NyQpLjc#WQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6PBQ6Lhw*NDg0FCw2ITdNDyxN EjpPC0xVSlVKTk5DTUJKSEhJSENDVTMWGhIXVQIUDw8aVRcSDjsOGBcUDh9VGBVFWVdZEgtZQVlK SUtVSkhJVUpVSU9IWVdZCAFZQUlKQ083Bg++ X-HM-Tid: 0a6ae93e40cc2086kuqy1aa2e41cab Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When sock dead, nbd_read_stat should return a ERR_PTR and then we should mark sock as dead and wait for a reconnection if the dead sock is the last one, because nbd_xmit_timeout won't resubmit while num_connections <= 1. Signed-off-by: Yao Liu --- drivers/block/nbd.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 22e86f4..a557a83 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -716,15 +716,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) if (result <= 0) { dev_err(disk_to_dev(nbd->disk), "Receive data failed (result %d)\n", result); - /* - * If we've disconnected or we only have 1 - * connection then we need to make sure we - * complete this request, otherwise error out - * and let the timeout stuff handle resubmitting - * this request onto another connection. - */ - if (nbd_disconnected(config) || - config->num_connections <= 1) { + if (nbd_disconnected(config)) { cmd->status = BLK_STS_IOERR; goto out; } -- 1.8.3.1