[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/14] blockdev: handle error on block latency histog
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 02/14] blockdev: handle error on block latency histogram set error |
Date: |
Mon, 12 Nov 2018 18:05:51 +0100 |
From: zhenwei pi <address@hidden>
Function block_latency_histogram_set may return error, but qapi ignore this.
This can be reproduced easily by qmp command:
virsh qemu-monitor-command INSTANCE '{"execute":"x-block-latency-histogram-set",
"arguments":{"device":"drive-virtio-disk1","boundaries":[10,200,40]}}'
In fact this command does not work, but we still get success result.
qmp_x_block_latency_histogram_set is a batch setting API, report error ASAP.
Signed-off-by: zhenwei pi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
blockdev.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index e5b5eb46e2..9310ff3e7c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4413,6 +4413,7 @@ void qmp_x_block_latency_histogram_set(
{
BlockBackend *blk = blk_by_name(device);
BlockAcctStats *stats;
+ int ret;
if (!blk) {
error_setg(errp, "Device '%s' not found", device);
@@ -4428,21 +4429,33 @@ void qmp_x_block_latency_histogram_set(
}
if (has_boundaries || has_boundaries_read) {
- block_latency_histogram_set(
+ ret = block_latency_histogram_set(
stats, BLOCK_ACCT_READ,
has_boundaries_read ? boundaries_read : boundaries);
+ if (ret) {
+ error_setg(errp, "Device '%s' set read boundaries fail", device);
+ return;
+ }
}
if (has_boundaries || has_boundaries_write) {
- block_latency_histogram_set(
+ ret = block_latency_histogram_set(
stats, BLOCK_ACCT_WRITE,
has_boundaries_write ? boundaries_write : boundaries);
+ if (ret) {
+ error_setg(errp, "Device '%s' set write boundaries fail", device);
+ return;
+ }
}
if (has_boundaries || has_boundaries_flush) {
- block_latency_histogram_set(
+ ret = block_latency_histogram_set(
stats, BLOCK_ACCT_FLUSH,
has_boundaries_flush ? boundaries_flush : boundaries);
+ if (ret) {
+ error_setg(errp, "Device '%s' set flush boundaries fail", device);
+ return;
+ }
}
}
--
2.19.1
- [Qemu-devel] [PULL 00/14] Block layer patches, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 01/14] file-posix: Use error API properly, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 03/14] blockdev: Consistently use snapshot_node_name in external_snapshot_prepare(), Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 02/14] blockdev: handle error on block latency histogram set error,
Kevin Wolf <=
- [Qemu-devel] [PULL 04/14] nvme: don't unref ctrl_mem when device unrealized, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 05/14] nvme: free cmbuf in nvme_exit, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 06/14] file-posix: Skip effectiveless OFD lock operations, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 09/14] block: Make more block drivers compile-time configurable, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 13/14] block: Fix potential Null pointer dereferences in vvfat.c, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 10/14] job: Fix off-by-one assert checks for JobSTT and JobVerbTable, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 11/14] block: Null pointer dereference in blk_root_get_parent_desc(), Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 14/14] qcow2: Read outside array bounds in qcow2_pre_write_overlap_check(), Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 07/14] file-posix: Drop s->lock_fd, Kevin Wolf, 2018/11/12
- [Qemu-devel] [PULL 08/14] tests: Add unit tests for image locking, Kevin Wolf, 2018/11/12