All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hou Pu <houpu@bytedance.com>
To: josef@toxicpanda.com, axboe@kernel.dk
Cc: mchristi@redhat.com, linux-block@vger.kernel.org,
	nbd@other.debian.org, Hou Pu <houpu@bytedance.com>
Subject: [PATCH 2/3] nbd: unify behavior in timeout no matter how many sockets is configured
Date: Mon, 21 Sep 2020 18:57:17 +0800	[thread overview]
Message-ID: <20200921105718.29006-3-houpu@bytedance.com> (raw)
In-Reply-To: <20200921105718.29006-1-houpu@bytedance.com>

When an nbd device is configured with multiple sockets, the request
is requeued to an active socket in xmit_timeout, the original socket
is closed if not.

Some time, the backend nbd server hang, thus all sockets will be
dropped and the nbd device is not usable. It would be better to have an
option to wait for more time (just reset timer in nbd_xmit_timeout).
Like what we do if we only have one socket. This patch allows it.

Signed-off-by: Hou Pu <houpu@bytedance.com>
---
 drivers/block/nbd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 538e9dcf5bf2..4c0bbb981cbc 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -400,8 +400,7 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
 	    nbd->tag_set.timeout)
 		goto error_out;
 
-	if (config->num_connections > 1 ||
-	    (config->num_connections == 1 && nbd->tag_set.timeout)) {
+	if (nbd->tag_set.timeout) {
 		dev_err_ratelimited(nbd_to_dev(nbd),
 				    "Connection timed out, retrying (%d/%d alive)\n",
 				    atomic_read(&config->live_connections),
@@ -432,9 +431,7 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
 			nbd_config_put(nbd);
 			return BLK_EH_DONE;
 		}
-	}
-
-	if (!nbd->tag_set.timeout) {
+	} else {
 		/*
 		 * Userspace sets timeout=0 to disable socket disconnection,
 		 * so just warn and reset the timer.
-- 
2.11.0


  parent reply	other threads:[~2020-09-21 10:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 10:57 [PATCH 0/3] nbd: improve timeout handling and a fix Hou Pu
2020-09-21 10:57 ` [PATCH 1/3] nbd: return -ETIMEDOUT when NBD_DO_IT ioctl returns Hou Pu
2020-09-21 18:04   ` Josef Bacik
2020-09-21 10:57 ` Hou Pu [this message]
2020-09-21 18:01   ` [PATCH 2/3] nbd: unify behavior in timeout no matter how many sockets is configured Josef Bacik
2020-09-22  3:14     ` Hou Pu
2020-09-21 10:57 ` [PATCH 3/3] nbd: introduce a client flag to do zero timeout handling Hou Pu
2020-09-21 18:03   ` Josef Bacik
2020-09-22  3:16     ` Hou Pu

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=20200921105718.29006-3-houpu@bytedance.com \
    --to=houpu@bytedance.com \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=nbd@other.debian.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.