From patchwork Wed Jan 16 23:04:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 213089 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 846DD2C008C for ; Thu, 17 Jan 2013 10:05:12 +1100 (EST) Received: from localhost ([::1]:50747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvc2g-0007ke-JU for incoming@patchwork.ozlabs.org; Wed, 16 Jan 2013 18:05:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvc2V-0007if-3d for qemu-devel@nongnu.org; Wed, 16 Jan 2013 18:05:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvc2S-0001cy-DV for qemu-devel@nongnu.org; Wed, 16 Jan 2013 18:04:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvc2S-0001cj-69 for qemu-devel@nongnu.org; Wed, 16 Jan 2013 18:04:56 -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 r0GN4tqm031434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Jan 2013 18:04:55 -0500 Received: from localhost ([10.3.112.10]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0GN4rJZ023838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 16 Jan 2013 18:04:54 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Wed, 16 Jan 2013 18:04:52 -0500 Message-Id: <9a76a255b7b5e09131dbd8d7503d07b489d7f8d0.1358373940.git.jcody@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: kwolf@redhat.com, armbru@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH] block: do_commit() does not pass along error messages for all 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 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'. This patch adds the appropriate error messages for the errors explicitely returned by bdrv_commit(). Signed-off-by: Jeff Cody --- blockdev.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/blockdev.c b/blockdev.c index d724e2d..7db7d8e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -657,6 +657,20 @@ void do_commit(Monitor *mon, const QDict *qdict) qerror_report(QERR_DEVICE_IN_USE, device); return; } + if (ret == -EACCES) { + qerror_report(QERR_DEVICE_IS_READ_ONLY, device); + return; + } + if (ret == -EIO) { + qerror_report(QERR_IO_ERROR); + return; + } + if (ret == -ENOTSUP) { + const char *format = bdrv_get_format_name(bs); + qerror_report(QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, + format ? format : "NULL", device, "commit"); + + } } }