qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] block: do_commit() does not pass along error messages for all errors
@ 2013-01-18 14:55 Jeff Cody
  2013-01-18 17:11 ` Markus Armbruster
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Cody @ 2013-01-18 14:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, armbru, stefanha, lcapitulino

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'.
Return error using monitor_printf() and strerror(), and covert existing
qerror_report() calls in do_commit() to use monitor_printf().

Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 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));
     }
 }
 
-- 
1.8.0.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] block: do_commit() does not pass along error messages for all errors
  2013-01-18 14:55 [Qemu-devel] [PATCH v2] block: do_commit() does not pass along error messages for all errors Jeff Cody
@ 2013-01-18 17:11 ` Markus Armbruster
  2013-01-18 17:47   ` Jeff Cody
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Armbruster @ 2013-01-18 17:11 UTC (permalink / raw)
  To: Jeff Cody; +Cc: kwolf, qemu-devel, stefanha, lcapitulino

Jeff Cody <jcody@redhat.com> writes:

> 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'.
> Return error using monitor_printf() and strerror(), and covert existing

s/covert/convert/

Suggest "Report error".

In the same vein, subject could be

    block: Monitor command commit neglects to report some errors

> qerror_report() calls in do_commit() to use monitor_printf().

Patch looks good to me.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] block: do_commit() does not pass along error messages for all errors
  2013-01-18 17:11 ` Markus Armbruster
@ 2013-01-18 17:47   ` Jeff Cody
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Cody @ 2013-01-18 17:47 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, qemu-devel, stefanha, lcapitulino

On Fri, Jan 18, 2013 at 06:11:25PM +0100, Markus Armbruster wrote:
> Jeff Cody <jcody@redhat.com> writes:
> 
> > 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'.
> > Return error using monitor_printf() and strerror(), and covert existing
> 
> s/covert/convert/
> 
> Suggest "Report error".
> 
> In the same vein, subject could be
> 
>     block: Monitor command commit neglects to report some errors
> 
> > qerror_report() calls in do_commit() to use monitor_printf().
> 
> Patch looks good to me.

Thanks - I went ahead and submitted a v3 with the proposed commit
message changes.

Thanks,
Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-18 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 14:55 [Qemu-devel] [PATCH v2] block: do_commit() does not pass along error messages for all errors Jeff Cody
2013-01-18 17:11 ` Markus Armbruster
2013-01-18 17:47   ` Jeff Cody

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).