|
|
7711c0 |
From 32850a2e3ed06394a0086acc19b484ddf4a2cef6 Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 27 Mar 2019 17:22:19 +0100
|
|
|
7711c0 |
Subject: [PATCH 080/163] block/nbd-client: use traces instead of noisy
|
|
|
7711c0 |
error_report_err
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190327172308.31077-7-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 85183
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 06/55] block/nbd-client: use traces instead of noisy error_report_err
|
|
|
7711c0 |
Bugzilla: 1691009
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Reduce extra noise of nbd-client, change 083 correspondingly.
|
|
|
7711c0 |
|
|
|
7711c0 |
In various commits (be41c100 in 2.10, f140e300 in 2.11, 78a33ab
|
|
|
7711c0 |
in 2.12), we added spots where qemu as an NBD client would report
|
|
|
7711c0 |
problems communicating with the server to stderr, because there
|
|
|
7711c0 |
was no where else to send the error to. However, this is racy,
|
|
|
7711c0 |
particularly since the most common source of these errors is when
|
|
|
7711c0 |
either the client or the server abruptly hangs up, leaving one
|
|
|
7711c0 |
coroutine to report the error only if it wins (or loses) the
|
|
|
7711c0 |
race in attempting the read from the server before another
|
|
|
7711c0 |
thread completes its cleanup of a protocol error that caused the
|
|
|
7711c0 |
disconnect in the first place. The race is also apparent in the
|
|
|
7711c0 |
fact that differences in the flush behavior of the server can
|
|
|
7711c0 |
alter the frequency of encountering the race in the client (see
|
|
|
7711c0 |
commit 6d39db96).
|
|
|
7711c0 |
|
|
|
7711c0 |
Rather than polluting stderr, it's better to just trace these
|
|
|
7711c0 |
situations, for use by developers debugging a flaky connection,
|
|
|
7711c0 |
particularly since the real error that either triggers the abrupt
|
|
|
7711c0 |
disconnection in the first place, or that results from the EIO
|
|
|
7711c0 |
when a request can't receive a reply, DOES make it back to the
|
|
|
7711c0 |
user in the normal Error propagation channels.
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
7711c0 |
Message-Id: <20181102151152.288399-4-vsementsov@virtuozzo.com>
|
|
|
7711c0 |
[eblake: drop depedence on error hint, enhance commit message]
|
|
|
7711c0 |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit d8b4bad846f08ff0f167b46dc156a5310b750484)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
block/nbd-client.c | 23 +++++++++++++++++++----
|
|
|
7711c0 |
block/trace-events | 4 ++++
|
|
|
7711c0 |
tests/qemu-iotests/083.out | 28 ----------------------------
|
|
|
7711c0 |
3 files changed, 23 insertions(+), 32 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/block/nbd-client.c b/block/nbd-client.c
|
|
|
7711c0 |
index fc5b7ed..ef32075 100644
|
|
|
7711c0 |
--- a/block/nbd-client.c
|
|
|
7711c0 |
+++ b/block/nbd-client.c
|
|
|
7711c0 |
@@ -28,6 +28,8 @@
|
|
|
7711c0 |
*/
|
|
|
7711c0 |
|
|
|
7711c0 |
#include "qemu/osdep.h"
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+#include "trace.h"
|
|
|
7711c0 |
#include "qapi/error.h"
|
|
|
7711c0 |
#include "nbd-client.h"
|
|
|
7711c0 |
|
|
|
7711c0 |
@@ -79,7 +81,8 @@ static coroutine_fn void nbd_read_reply_entry(void *opaque)
|
|
|
7711c0 |
assert(s->reply.handle == 0);
|
|
|
7711c0 |
ret = nbd_receive_reply(s->ioc, &s->reply, &local_err);
|
|
|
7711c0 |
if (local_err) {
|
|
|
7711c0 |
- error_report_err(local_err);
|
|
|
7711c0 |
+ trace_nbd_read_reply_entry_fail(ret, error_get_pretty(local_err));
|
|
|
7711c0 |
+ error_free(local_err);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
if (ret <= 0) {
|
|
|
7711c0 |
break;
|
|
|
7711c0 |
@@ -771,7 +774,11 @@ static int nbd_co_request(BlockDriverState *bs, NBDRequest *request,
|
|
|
7711c0 |
|
|
|
7711c0 |
ret = nbd_co_receive_return_code(client, request->handle, &local_err);
|
|
|
7711c0 |
if (local_err) {
|
|
|
7711c0 |
- error_report_err(local_err);
|
|
|
7711c0 |
+ trace_nbd_co_request_fail(request->from, request->len, request->handle,
|
|
|
7711c0 |
+ request->flags, request->type,
|
|
|
7711c0 |
+ nbd_cmd_lookup(request->type),
|
|
|
7711c0 |
+ ret, error_get_pretty(local_err));
|
|
|
7711c0 |
+ error_free(local_err);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
return ret;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
@@ -802,7 +809,11 @@ int nbd_client_co_preadv(BlockDriverState *bs, uint64_t offset,
|
|
|
7711c0 |
ret = nbd_co_receive_cmdread_reply(client, request.handle, offset, qiov,
|
|
|
7711c0 |
&local_err);
|
|
|
7711c0 |
if (local_err) {
|
|
|
7711c0 |
- error_report_err(local_err);
|
|
|
7711c0 |
+ trace_nbd_co_request_fail(request.from, request.len, request.handle,
|
|
|
7711c0 |
+ request.flags, request.type,
|
|
|
7711c0 |
+ nbd_cmd_lookup(request.type),
|
|
|
7711c0 |
+ ret, error_get_pretty(local_err));
|
|
|
7711c0 |
+ error_free(local_err);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
return ret;
|
|
|
7711c0 |
}
|
|
|
7711c0 |
@@ -925,7 +936,11 @@ int coroutine_fn nbd_client_co_block_status(BlockDriverState *bs,
|
|
|
7711c0 |
ret = nbd_co_receive_blockstatus_reply(client, request.handle, bytes,
|
|
|
7711c0 |
&extent, &local_err);
|
|
|
7711c0 |
if (local_err) {
|
|
|
7711c0 |
- error_report_err(local_err);
|
|
|
7711c0 |
+ trace_nbd_co_request_fail(request.from, request.len, request.handle,
|
|
|
7711c0 |
+ request.flags, request.type,
|
|
|
7711c0 |
+ nbd_cmd_lookup(request.type),
|
|
|
7711c0 |
+ ret, error_get_pretty(local_err));
|
|
|
7711c0 |
+ error_free(local_err);
|
|
|
7711c0 |
}
|
|
|
7711c0 |
if (ret < 0) {
|
|
|
7711c0 |
return ret;
|
|
|
7711c0 |
diff --git a/block/trace-events b/block/trace-events
|
|
|
7711c0 |
index c35287b..6d4d399 100644
|
|
|
7711c0 |
--- a/block/trace-events
|
|
|
7711c0 |
+++ b/block/trace-events
|
|
|
7711c0 |
@@ -150,3 +150,7 @@ nvme_free_req_queue_wait(void *q) "q %p"
|
|
|
7711c0 |
nvme_cmd_map_qiov(void *s, void *cmd, void *req, void *qiov, int entries) "s %p cmd %p req %p qiov %p entries %d"
|
|
|
7711c0 |
nvme_cmd_map_qiov_pages(void *s, int i, uint64_t page) "s %p page[%d] 0x%"PRIx64
|
|
|
7711c0 |
nvme_cmd_map_qiov_iov(void *s, int i, void *page, int pages) "s %p iov[%d] %p pages %d"
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+# block/nbd-client.c
|
|
|
7711c0 |
+nbd_read_reply_entry_fail(int ret, const char *err) "ret = %d, err: %s"
|
|
|
7711c0 |
+nbd_co_request_fail(uint64_t from, uint32_t len, uint64_t handle, uint16_t flags, uint16_t type, const char *name, int ret, const char *err) "Request failed { .from = %" PRIu64", .len = %" PRIu32 ", .handle = %" PRIu64 ", .flags = 0x%" PRIx16 ", .type = %" PRIu16 " (%s) } ret = %d, err: %s"
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out
|
|
|
7711c0 |
index f9af8bb..7419722 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/083.out
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/083.out
|
|
|
7711c0 |
@@ -41,8 +41,6 @@ can't open device nbd+tcp://127.0.0.1:PORT/foo
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after neg2 ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unable to read from socket: Connection reset by peer
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect 8 neg2 ===
|
|
|
7711c0 |
@@ -55,40 +53,30 @@ can't open device nbd+tcp://127.0.0.1:PORT/foo
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before request ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unable to read from socket: Connection reset by peer
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after request ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect 4 reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect 8 reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before data ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after data ===
|
|
|
7711c0 |
@@ -118,8 +106,6 @@ can't open device nbd+tcp://127.0.0.1:PORT/
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after neg-classic ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unable to read from socket: Connection reset by peer
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before neg1 ===
|
|
|
7711c0 |
@@ -164,8 +150,6 @@ can't open device nbd+unix:///foo?socket=TEST_DIR/nbd.sock
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after neg2 ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unable to read from socket: Connection reset by peer
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect 8 neg2 ===
|
|
|
7711c0 |
@@ -178,40 +162,30 @@ can't open device nbd+unix:///foo?socket=TEST_DIR/nbd.sock
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before request ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unable to read from socket: Connection reset by peer
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after request ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect 4 reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect 8 reply ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect before data ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unexpected end-of-file before all bytes were read
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after data ===
|
|
|
7711c0 |
@@ -241,8 +215,6 @@ can't open device nbd+unix:///?socket=TEST_DIR/nbd.sock
|
|
|
7711c0 |
|
|
|
7711c0 |
=== Check disconnect after neg-classic ===
|
|
|
7711c0 |
|
|
|
7711c0 |
-Unable to read from socket: Connection reset by peer
|
|
|
7711c0 |
-Connection closed
|
|
|
7711c0 |
read failed: Input/output error
|
|
|
7711c0 |
|
|
|
7711c0 |
*** done
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|