From patchwork Fri Jan 25 14:14:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 215740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CFBF02C008F for ; Sat, 26 Jan 2013 01:14:56 +1100 (EST) Received: from localhost ([::1]:59515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyk3S-0000Ls-RN for incoming@patchwork.ozlabs.org; Fri, 25 Jan 2013 09:14:54 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyk3A-0000J9-Sa for qemu-devel@nongnu.org; Fri, 25 Jan 2013 09:14:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tyk37-0004YO-6q for qemu-devel@nongnu.org; Fri, 25 Jan 2013 09:14:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyk36-0004YI-VG for qemu-devel@nongnu.org; Fri, 25 Jan 2013 09:14:33 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0PEEWIx020871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 25 Jan 2013 09:14:32 -0500 Received: from localhost (ovpn-113-104.phx2.redhat.com [10.3.113.104]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0PEEV0H002561; Fri, 25 Jan 2013 09:14:32 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2013 12:14:32 -0200 Message-Id: <1359123278-8681-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1359123278-8681-1-git-send-email-lcapitulino@redhat.com> References: <1359123278-8681-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PULL 1/7] block: Monitor command commit neglects to report some errors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jeff Cody The non-live bdrv_commit() function may return one of the following errors: -ENOTSUP, -EBUSY, -EACCES, -EIO. The only error that is checked in the HMP handler is -EBUSY, so the monitor command 'commit' silently fails for all error cases other than 'Device is in use'. Report error using monitor_printf() and strerror(), and convert existing qerror_report() calls in do_commit() to monitor_printf(). Signed-off-by: Jeff Cody Reviewed-by: Markus Armbruster Signed-off-by: Luiz Capitulino --- blockdev.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/blockdev.c b/blockdev.c index 9126587..030070b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -642,21 +642,17 @@ void do_commit(Monitor *mon, const QDict *qdict) if (!strcmp(device, "all")) { ret = bdrv_commit_all(); - if (ret == -EBUSY) { - qerror_report(QERR_DEVICE_IN_USE, device); - return; - } } else { bs = bdrv_find(device); if (!bs) { - qerror_report(QERR_DEVICE_NOT_FOUND, device); + monitor_printf(mon, "Device '%s' not found\n", device); return; } ret = bdrv_commit(bs); - if (ret == -EBUSY) { - qerror_report(QERR_DEVICE_IN_USE, device); - return; - } + } + if (ret < 0) { + monitor_printf(mon, "'commit' error for '%s': %s\n", device, + strerror(-ret)); } }