From: Hou Pu <houpu.main@gmail.com>
To: josef@toxicpanda.com, axboe@kernel.dk, mchristi@redhat.com
Cc: linux-block@vger.kernel.org, nbd@other.debian.org,
Hou Pu <houpu@bytedance.com>
Subject: [PATCH 1/2] nbd: enable replace socket if only one connection is configured
Date: Fri, 28 Feb 2020 01:40:29 -0500 [thread overview]
Message-ID: <20200228064030.16780-2-houpu@bytedance.com> (raw)
In-Reply-To: <20200228064030.16780-1-houpu@bytedance.com>
Nbd server with multiple connections could be upgraded since
560bc4b (nbd: handle dead connections). But if only one conncection
is configured, after we take down nbd server, all inflight IO
would finally timeout and return error. We could requeue them
like what we do with multiple connections and wait for new socket
in submit path.
Signed-off-by: Hou Pu <houpu@bytedance.com>
---
drivers/block/nbd.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 78181908f0df..83070714888b 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -395,16 +395,19 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
}
config = nbd->config;
- if (config->num_connections > 1) {
+ if (config->num_connections > 1 ||
+ (config->num_connections == 1 && nbd->tag_set.timeout)) {
dev_err_ratelimited(nbd_to_dev(nbd),
"Connection timed out, retrying (%d/%d alive)\n",
atomic_read(&config->live_connections),
config->num_connections);
/*
* Hooray we have more connections, requeue this IO, the submit
- * path will put it on a real connection.
+ * path will put it on a real connection. Or if only one
+ * connection is configured, the submit path will wait util
+ * a new connection is reconfigured or util dead timeout.
*/
- if (config->socks && config->num_connections > 1) {
+ if (config->socks) {
if (cmd->index < config->num_connections) {
struct nbd_sock *nsock =
config->socks[cmd->index];
@@ -741,14 +744,12 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
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
+ * If we've disconnected, 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;
}
@@ -825,7 +826,7 @@ static int find_fallback(struct nbd_device *nbd, int index)
if (config->num_connections <= 1) {
dev_err_ratelimited(disk_to_dev(nbd->disk),
- "Attempted send on invalid socket\n");
+ "Dead connection, failed to find a fallback\n");
return new_index;
}
--
2.11.0
next prev parent reply other threads:[~2020-02-28 6:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 6:40 [PATCH v2 0/2] nbd: requeue request if only one connection is configured Hou Pu
2020-02-28 6:40 ` Hou Pu [this message]
2020-03-03 21:12 ` [PATCH 1/2] nbd: enable replace socket " Josef Bacik
2020-03-03 21:48 ` Mike Christie
2020-03-04 5:41 ` Hou Pu
2020-03-04 18:48 ` Josef Bacik
2020-02-28 6:40 ` [PATCH 2/2] nbd: requeue command if the soecket is changed Hou Pu
2020-03-03 21:13 ` Josef Bacik
2020-03-03 22:06 ` Mike Christie
2020-03-03 22:21 ` Mike Christie
2020-03-04 7:13 ` Hou Pu
2020-03-04 18:48 ` Josef Bacik
2020-03-12 13:59 ` [PATCH v2 0/2] nbd: requeue request if only one connection is configured Jens Axboe
2020-03-13 11:29 ` Hou Pu
-- strict thread matches above, loose matches on Subject: below --
2020-02-19 6:31 [PATCH 0/2] " Hou Pu
2020-02-19 6:31 ` [PATCH 1/2] nbd: enable replace socket " Hou Pu
2020-02-25 6:32 ` Mike Christie
2020-02-25 14:10 ` 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=20200228064030.16780-2-houpu@bytedance.com \
--to=houpu.main@gmail.com \
--cc=axboe@kernel.dk \
--cc=houpu@bytedance.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox