Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4757878ybi; Tue, 28 May 2019 01:57:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLasLhf+mXrbF31S0O4EyPyp01H5rGP17vQxiu0j9oWt/X0bZjr8TPkQpGdTmwew/Bsu6+ X-Received: by 2002:a62:d286:: with SMTP id c128mr141362453pfg.159.1559033862884; Tue, 28 May 2019 01:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559033862; cv=none; d=google.com; s=arc-20160816; b=LigTFRf7Tvbngd1Lpnalzdu7FB/BX64nmbXl5f4Inuek/DWl9+FH4zTExgEaH1s0rp cA3Oq15HbGfZMlQueWLkPDs7V0EZkk8gC+hksbopW67ih4HnDCXyUQddoLE7sQPeGDbD rahX3E9lVtSsBYtoLo/t4A+z7meTWDEaPPaYLXxDX6fVJrxHxpQoFyOvLfGl/u8d3acr dx93hIL+49zMEqZp9+P6k4hy4BecISW0D6TsD4sobX9t90A69dQbZthRcuYHhG8z8sNw MaAJtngy4v1SKAgcVDS/VCpwyf6xHnC3OYmOsBn8j5WC4H+RJvtCg6Eo0h4s2Kq4s88c 1TUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=kCJx27/Ai91gQk6ZgjxrrD2d9/+wWCRhXOjbL6NwPKY=; b=An6PJa7p9j2gPPxiox67hBQTKwwNIJFRwPr3zZlHjd+Ccvo8GbQcCzSi6ggL92CWyR BD3vGmvzSSr8nbEVdJzQ7acSUsvMFSAA2sa2cAbmsfmKoioSDyEjE8geKM55L1VowVuO hn+t9kSDQ0tHfOKO4kYM8BVsvNtm5FFl3EqMV/Yj2HPHV1Ju/Of7453G7UHoupSo7/sa 8gQwa/XsCsNpkK0d4OrlshgSvoDHV/PuPHT5gVzoK/1FUInAPqGRxvOhcmMFMmBukb7n J9O9PQrHb0DsxUA4j7BPDH/SwkVmaB6cjhrDLnkJKQ0h2XwI7UdL9mKchxClGrc9mjOV Chwg== 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 d62si21161181pga.447.2019.05.28.01.57.26; Tue, 28 May 2019 01:57:42 -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 S1726718AbfE1I4S (ORCPT + 99 others); Tue, 28 May 2019 04:56:18 -0400 Received: from m97179.mail.qiye.163.com ([220.181.97.179]:10709 "EHLO m97179.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726438AbfE1I4R (ORCPT ); Tue, 28 May 2019 04:56:17 -0400 Received: from localhost (unknown [120.132.1.243]) by m97179.mail.qiye.163.com (Hmail) with ESMTPA id 02FDBE01982; Tue, 28 May 2019 16:56:05 +0800 (CST) Date: Tue, 28 May 2019 02:29:25 +0800 From: Yao Liu To: Josef Bacik Cc: Jens Axboe , linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org Subject: Re: Re: [PATCH 3/3] nbd: mark sock as dead even if it's the last one Message-ID: <20190527182925.GC20702@192-168-150-246.7~> References: <1558691036-16281-1-git-send-email-yotta.liu@ucloud.cn> <1558691036-16281-3-git-send-email-yotta.liu@ucloud.cn> <20190524131714.i3lbkbokad6xmotv@MacBook-Pro-91.local.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190524131714.i3lbkbokad6xmotv@MacBook-Pro-91.local.dhcp.thefacebook.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-HM-Spam-Status: e1kIGBQJHllBWUtVQ01DQkJCTExCSUlPSEJNWVdZKFlBSUI3V1ktWUFJV1 kJDhceCFlBWTU0KTY6NyQpLjc#WQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MFE6Qgw4IjgrCCNCIQscMQJR Iw9PFDRVSlVKTk5CS0hITE1OSk1MVTMWGhIXVQIUDw8aVRcSDjsOGBcUDh9VGBVFWVdZEgtZQVlK SUtVSkhJVUpVSU9IWVdZCAFZQUlISk83Bg++ X-HM-Tid: 0a6afda75c9820bdkuqy02fdbe01982 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 24, 2019 at 09:17:15AM -0400, Josef Bacik wrote: > On Fri, May 24, 2019 at 05:43:56PM +0800, Yao Liu wrote: > > 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. > > num_connections is the total number of connections that the device was set up > with, not how many are left. Now since we have the dead_conn_timeout timeout > stuff now which didn't exist when I originally wrote this code I'd be ok with > doing that, but not the way you have it now. It would be something more like > > if (nbd_disconnected(config) || > (config->num_connections <= 1 && > !config->dead_conn_timeout) > > instead. Thanks, > > Josef > Your solution is better indeed.