qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
	armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3] block: Monitor command commit neglects to report some errors
Date: Fri, 18 Jan 2013 17:37:05 -0200	[thread overview]
Message-ID: <20130118173705.3abdb9f2@doriath.home> (raw)
In-Reply-To: <bee85205edf784bff9d0c95acec03aa5af536546.1358530981.git.jcody@redhat.com>

On Fri, 18 Jan 2013 12:45:35 -0500
Jeff Cody <jcody@redhat.com> wrote:

> 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 <jcody@redhat.com>

Applied to the qmp branch, thanks.

> ---
>  blockdev.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/blockdev.c b/blockdev.c
> index d724e2d..cb3b426 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));
>      }
>  }
>  

      parent reply	other threads:[~2013-01-18 19:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 17:45 [Qemu-devel] [PATCH v3] block: Monitor command commit neglects to report some errors Jeff Cody
2013-01-18 18:08 ` Markus Armbruster
2013-01-18 19:37 ` Luiz Capitulino [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130118173705.3abdb9f2@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).