From nobody Thu Nov 6 06:18:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=bytedance.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539872987351574.8584777775013; Thu, 18 Oct 2018 07:29:47 -0700 (PDT) Received: from localhost ([::1]:42659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD9J3-0004HG-U0 for importer@patchew.org; Thu, 18 Oct 2018 10:29:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD5kv-0005I1-Sa for qemu-devel@nongnu.org; Thu, 18 Oct 2018 06:42:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gD5ks-0001wT-Iy for qemu-devel@nongnu.org; Thu, 18 Oct 2018 06:42:17 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:39513) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gD5ks-0001ve-9C for qemu-devel@nongnu.org; Thu, 18 Oct 2018 06:42:14 -0400 Received: by mail-pl1-x641.google.com with SMTP id e67-v6so5165865plb.6 for ; Thu, 18 Oct 2018 03:42:13 -0700 (PDT) Received: from [10.2.9.206] ([203.12.205.220]) by smtp.gmail.com with ESMTPSA id g87-v6sm25604028pfj.34.2018.10.18.03.42.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 03:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=m41Zw6QI3Bhrmhoen1ZwmX3HcwdCQMSSGVhEL0m6NJU=; b=DPpGw6r7Gy1uSF2nBpJ5bdCiQGv+wP6dQ3iN0rYRU8VY4uNie7+bSEr09AJ4IKrjy7 jiny6nypk7feoWB7zIJReQrmSlLJdWMU3a6+4+dwSst6/Ztlbhqbn4sOR3VwS4q+AlhE WeOShHJqHTbtGdJ/BCRMZpg3ACrn1YvDiEguMOOzbiBtvl6EKzVANgZ5zjF46shQE1fP 6TV+cA3S7OIVDR0Jn9ut4hMC8hZhfz2A5TSl3tJVROxwMVTB3ta2wYlxgBF7IGQHGLAb lbhaT1G7tVN+T/gCuyLOe1r71j1oqXqcSdSzkc8q5efBb4i2iBwmvQWlrnFnRBxcT17s dtKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=m41Zw6QI3Bhrmhoen1ZwmX3HcwdCQMSSGVhEL0m6NJU=; b=NL2GkDUw+IA/4Z5TEwJsXFsTO27Nxrsm7kw8HOpm7CoSHGMUTfK3we+RvbbuS/3TtV 1iX01G2cNb8I5StT1klRHGPxiBeevSMI5FPcVFm25Wh2mXsCllJdZC7lDgBMunSj5F1X tiiAR9gsFH2vzvXIULTuDM8+B29FrwIcop+Myal9QhxAp6iMIDbDWdhzki0vscC9jO8L 2YM2k9ypVWc3gS14JtVRak0sfC49Ia1lEa7HcPTlYASrt4fr4SB9R1dleS4WGL45Y70R vD4hafmUHXunjWwcOSvYMpZ5alWQ5iRffGNiKkp2CLUVttMCE7pjMU01Nje6NY7CAqVh 6huA== X-Gm-Message-State: ABuFfoj4zUiF5xE15evbbTPGzvsgHIKc7ZcQALOgaLxkm0a8ftxzbX0W MlyA/fg+VwxNxrB9e6m8M0SenA== X-Google-Smtp-Source: ACcGV63FKswQKStkZEDHUzdrKcf7tbCJUEPCAvbWDq2/vQoCzmjBwSPlAeTfnGrIyNSLzVL/HIWG/Q== X-Received: by 2002:a17:902:7897:: with SMTP id q23-v6mr29977421pll.54.1539859332781; Thu, 18 Oct 2018 03:42:12 -0700 (PDT) To: kwolf@redhat.com, mreitz@redhat.com From: zhenwei pi Message-ID: Date: Thu, 18 Oct 2018 18:42:09 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 X-Mailman-Approved-At: Thu, 18 Oct 2018 10:27:29 -0400 Subject: [Qemu-devel] [PATCH] blockdev: report error on block latency histogram set error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vsementsov@virtuozzo.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8"; format="flowed" 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 --- blockdev.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index a8755bd..03b1aa3 100644 --- a/blockdev.c +++ b/blockdev.c @@ -4377,6 +4377,7 @@ void qmp_x_block_latency_histogram_set( { BlockBackend *blk =3D blk_by_name(device); BlockAcctStats *stats; + int ret; =20 if (!blk) { error_setg(errp, "Device '%s' not found", device); @@ -4392,21 +4393,33 @@ void qmp_x_block_latency_histogram_set( } =20 if (has_boundaries || has_boundaries_read) { - block_latency_histogram_set( + ret =3D 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", devic= e); + return; + } } =20 if (has_boundaries || has_boundaries_write) { - block_latency_histogram_set( + ret =3D 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", devi= ce); + return; + } } =20 if (has_boundaries || has_boundaries_flush) { - block_latency_histogram_set( + ret =3D 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", devi= ce); + return; + } } } =20 --=20 2.7.4