LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yao Liu <yotta.liu@ucloud.cn>
To: Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, nbd@other.debian.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] nbd: notify userland even if nbd has already disconnected
Date: Fri, 24 May 2019 17:43:55 +0800	[thread overview]
Message-ID: <1558691036-16281-2-git-send-email-yotta.liu@ucloud.cn> (raw)
In-Reply-To: <1558691036-16281-1-git-send-email-yotta.liu@ucloud.cn>

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 <yotta.liu@ucloud.cn>
---
 drivers/block/nbd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ca69d6e..22e86f4 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -246,7 +246,7 @@ static int nbd_disconnected(struct nbd_config *config)
 static void nbd_mark_nsock_dead(struct nbd_device *nbd, struct nbd_sock *nsock,
 				int notify)
 {
-	if (!nsock->dead && notify && !nbd_disconnected(nbd->config)) {
+	if (!nsock->dead && notify) {
 		struct link_dead_args *args;
 		args = kmalloc(sizeof(struct link_dead_args), GFP_NOIO);
 		if (args) {
@@ -1891,7 +1891,6 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd)
 {
 	mutex_lock(&nbd->config_lock);
 	nbd_disconnect(nbd);
-	nbd_clear_sock(nbd);
 	mutex_unlock(&nbd->config_lock);
 	if (test_and_clear_bit(NBD_HAS_CONFIG_REF,
 			       &nbd->config->runtime_flags))
-- 
1.8.3.1


  reply	other threads:[~2019-05-24  9:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24  9:43 [PATCH 1/3] nbd: fix connection timed out error after reconnecting to server Yao Liu
2019-05-24  9:43 ` Yao Liu [this message]
2019-05-24 13:08   ` [PATCH 2/3] nbd: notify userland even if nbd has already disconnected Josef Bacik
2019-05-27 18:23     ` Yao Liu
2019-05-28 16:36       ` Mike Christie
2019-05-28 20:05         ` Yao Liu
2019-05-28 16:54       ` Josef Bacik
2019-05-24  9:43 ` [PATCH 3/3] nbd: mark sock as dead even if it's the last one Yao Liu
2019-05-24 13:17   ` Josef Bacik
2019-05-27 18:29     ` Yao Liu
2019-05-24 13:07 ` [PATCH 1/3] nbd: fix connection timed out error after reconnecting to server Josef Bacik
2019-05-27 18:07   ` Yao Liu
2019-05-28 16:57     ` Josef Bacik
2019-05-28 19:04       ` Yao Liu
2019-05-29 13:49         ` Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1558691036-16281-2-git-send-email-yotta.liu@ucloud.cn \
    --to=yotta.liu@ucloud.cn \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --subject='Re: [PATCH 2/3] nbd: notify userland even if nbd has already disconnected' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).