[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/12] nbd/server: Ignore write errors when replying
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PULL 05/12] nbd/server: Ignore write errors when replying to NBD_OPT_ABORT |
Date: |
Mon, 19 Nov 2018 11:54:20 -0600 |
Commit 37ec36f6 intentionally ignores errors when trying to reply
to an NBD_OPT_ABORT request for plaintext clients, but did not make
the same change for a TLS server. Since NBD_OPT_ABORT is
documented as being a potential for an EPIPE when the client hangs
up without waiting for our reply, we don't need to pollute the
server's output with that failure.
Signed-off-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
---
nbd/server.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 056cfa5ad47..dc04513de70 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1134,12 +1134,16 @@ static int nbd_negotiate_options(NBDClient *client,
uint16_t myflags,
return -EINVAL;
default:
- ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD, errp,
+ /* Let the client keep trying, unless they asked to
+ * quit. Always try to give an error back to the
+ * client; but when replying to OPT_ABORT, be aware
+ * that the client may hang up before receiving the
+ * error, in which case we are fine ignoring the
+ * resulting EPIPE. */
+ ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD,
+ option == NBD_OPT_ABORT ? NULL : errp,
"Option 0x%" PRIx32
" not permitted before TLS", option);
- /* Let the client keep trying, unless they asked to
- * quit. In this mode, we've already sent an error, so
- * we can't ack the abort. */
if (option == NBD_OPT_ABORT) {
return 1;
}
--
2.17.2
- [Qemu-devel] [PULL 00/12] NBD patches for 3.1-rc2, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 02/12] qemu-iotests: convert `pwd` and $(pwd) to $PWD, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 04/12] nbd: fix whitespace in server error message, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 06/12] io: return 0 for EOF in TLS session read after shutdown, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 03/12] qemu-iotests: Modern shell scripting (use $() instead of ``), Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 05/12] nbd/server: Ignore write errors when replying to NBD_OPT_ABORT,
Eric Blake <=
- [Qemu-devel] [PULL 09/12] tests: add iotests helpers for dealing with TLS certificates, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 08/12] tests: check if qemu-nbd is still alive before waiting, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 07/12] tests: pull qemu-nbd iotest helpers into common.nbd file, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 11/12] iotests: Also test I/O over NBD TLS, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 10/12] tests: exercise NBD server in TLS mode, Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 12/12] iotests: Drop use of bash keyword 'function', Eric Blake, 2018/11/19
- [Qemu-devel] [PULL 01/12] qemu-iotests: remove unused variable 'here', Eric Blake, 2018/11/19
- Re: [Qemu-devel] [PULL 00/12] NBD patches for 3.1-rc2, Peter Maydell, 2018/11/20