Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5254089ybi; Tue, 28 May 2019 09:55:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqycrFd19NSjNk+N5gp/iZECitq5vzjmEW7qdnQErkhXXnLvijsSFPWh0oTze+CGJEuH/UCz X-Received: by 2002:a62:ab0a:: with SMTP id p10mr45882309pff.143.1559062551067; Tue, 28 May 2019 09:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559062551; cv=none; d=google.com; s=arc-20160816; b=Ih4pkKe0cNhcJkWlDqvvIDbFjulYVjH37T9E+l/iSubzpFhAhnCFWJEMpb+2lsuRK9 s9tqfHsedPsKDwBdKHD4KneKSu3jayFyqjeJunZrqiUA3IAvQ8pWNlR3XFAe5W6RlhH9 fM5e3rqyGoZ/KRIKroIei9d9lLQITJmszoh4jESsQ1KuKMZLZ3Q8EYVx+vlm5V5Ig1Mn a3RdTOKsTv4Cl/NRE4a9AfK3oSjeUdQL/XizAyHqY11E4n/Gop2E7osTmKI6VyCX/HYh sQbVuySJpq9md/sQ0zwoXeOy7iJIlw3P3o1W+JOk8ZTeBzTuva0zEnAIwxB/k5Pdpqvw gIdQ== 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:dkim-signature; bh=HQt9C+mDH/TUYn5kg6jHMMxiwsbiOA+Z5/e525L3AMA=; b=mzrtzQ82VUNGPNxUX7T7D9gkrTjuREEc5DbU4eNEj2Vq5cCNKGChbg3FTf7076YhOv WBWwvTeUfLekj9W/NTJtuEAwSgBP+HKoX7JLTv8hLJ4/CoL8WXphCZ0bM/rfT/yM1muA ASgdFcpT1VDdYSuZ9UwCwte6JzImAqo92EZXRcOSJ4nxgwQIdqKFzXMSbRdhHu92H49e PPWEFUQT2vfm5Hfy7lKITxBi+mAJVprF9/vP9GQsqizYRcump77W4f/9cSWEV4qIA9fn vXuY22IjPhgYonO8mlOatAxPfeYnNGBdxq6OKJ6AbDGlSILb95emd/IQ07TU7DFqac7u hX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=uzWeB+uG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si22172088pgs.90.2019.05.28.09.55.34; Tue, 28 May 2019 09:55:51 -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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=uzWeB+uG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727035AbfE1Qy2 (ORCPT + 99 others); Tue, 28 May 2019 12:54:28 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:34342 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbfE1Qy1 (ORCPT ); Tue, 28 May 2019 12:54:27 -0400 Received: by mail-vs1-f66.google.com with SMTP id q64so671934vsd.1 for ; Tue, 28 May 2019 09:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HQt9C+mDH/TUYn5kg6jHMMxiwsbiOA+Z5/e525L3AMA=; b=uzWeB+uGT3cAPGvt3ADTuyydh02gLjz+m42TrKNuu1mZ1XPtAAgf+ygS4izSAfMYso W/Zg+95lTcBcr0PNRoeVVxeZUU5CVuqpjygraX8eNiqPjzXwhQgf4VnAgw89sB3Si+jG 9rwcfY4d8v6APQDB7tDD+TEGPBKBvXlN2PXrLHOZskAXc1VWyWJdIg6K24A9VjC08QD8 FUiqa3dFymS6kadeHhfhd9hyRe7emM2wO179JH17TY4M9oOHCgnz22Zoc6Lnooxqnx66 RadD87A/8ZoeYU4AejspEwfkEJrTgE1rO9/xe54mmpYbXb9l3FEJfHGs8nbWueLyT6d/ KfuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HQt9C+mDH/TUYn5kg6jHMMxiwsbiOA+Z5/e525L3AMA=; b=IeFcGCh0AQzqI+4/OFTHytlftU/Sf4q0Yp600HxqHt9CYwOgU5VVL/lqJpFAH0gSdc hh01n5niFWfX4okJODUu6y53hgb1Xh0fyJ6VDlgXdchjzt3wMWgT1BxCEV24VSFWDdLh vk+w5PBNEVLd3vgHyUVuJMQ0Xy7FKvfGthgPhqQ03Tz0g2KoqTlMgFaPFxr79YcNYL/o tYQSiVH2zuhbE127PFKTRyZNIPJ4veT+tTZzVBlcTqdDH7l+qo71T14vwJXVb+zJu5jP nQN8XaAJnhvBWDXD4X/IdPQ7RdZup0XdoasKizJhxCrMqh6GOCP6YwH+4KtbjyVVi3aB RoIA== X-Gm-Message-State: APjAAAWWvjMxCCXmvF9Y0nB019T2x/c2w3gCbu95Mo5gmtuLaWOP5BuF v7GPP5BEOaOBVfuKPD6fGdIarUZVIshrAQ== X-Received: by 2002:a67:3052:: with SMTP id w79mr57705721vsw.68.1559062466594; Tue, 28 May 2019 09:54:26 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::6684]) by smtp.gmail.com with ESMTPSA id e76sm16361362vke.54.2019.05.28.09.54.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 09:54:25 -0700 (PDT) Date: Tue, 28 May 2019 12:54:24 -0400 From: Josef Bacik To: Yao Liu Cc: Josef Bacik , Jens Axboe , linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] nbd: notify userland even if nbd has already disconnected Message-ID: <20190528165422.bi27p6czm477bxsg@MacBook-Pro-91.local> References: <1558691036-16281-1-git-send-email-yotta.liu@ucloud.cn> <1558691036-16281-2-git-send-email-yotta.liu@ucloud.cn> <20190524130856.zod5agp7hk74pcnr@MacBook-Pro-91.local.dhcp.thefacebook.com> <20190527182323.GB20702@192-168-150-246.7~> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190527182323.GB20702@192-168-150-246.7~> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 28, 2019 at 02:23:23AM +0800, Yao Liu wrote: > On Fri, May 24, 2019 at 09:08:58AM -0400, Josef Bacik wrote: > > On Fri, May 24, 2019 at 05:43:55PM +0800, Yao Liu wrote: > > > Some nbd client implementations have a userland's daemon, so we should > > > inform client daemon to clean up and exit. > > > > > > Signed-off-by: Yao Liu > > > > Except the nbd_disconnected() check is for the case that the client told us > > specifically to disconnect, so we don't want to send the notification to > > re-connect because we've already been told we want to tear everything down. > > Nack to this as well. Thanks, > > > > Josef > > > > But in userland, client daemon process and process which send disconnect > command are not same process, so they are not clear to each other, so > client daemon expect driver inform it to exit. > In addition, client daemon will get nbd status with nbd_genl_status interface > after it get notified and it should not re-connect if status connected == 0 Right this is the point. The daemon is dumb, if it gets a disconnected message it'll try to reconnect, so we don't want to send a disconnected message if we were specifically told to disconnect. We don't want to rely on userspace to try and manage this weird state machine. If you want userland to know its time to disconnect then have your implementation handle being told to disconnect and handle all the things. Thanks, Josef