From patchwork Thu Oct 18 10:42:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhenwei pi X-Patchwork-Id: 985922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="DPpGw6r7"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42bWd94Zfzz9s4Z for ; Fri, 19 Oct 2018 01:29:01 +1100 (AEDT) Received: from localhost ([::1]:42656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gD9IJ-0003hl-A0 for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2018 10:28:59 -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) 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) 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) 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-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 = blk_by_name(device); BlockAcctStats *stats; + int ret; if (!blk) { error_setg(errp, "Device '%s' not found", device); @@ -4392,21 +4393,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; + } } }