summary refs log tree commit diff stats
path: root/block/commit.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-06-29 17:38:57 +0200
committerKevin Wolf <kwolf@redhat.com>2016-07-13 13:32:27 +0200
commit1e8fb7f1ee1ba902ab06cb8d54eca006c3b45f42 (patch)
treed91e85db48b8e9d779a0a5bf7c329f90fd49358c /block/commit.c
parentf6166a06ffdb1cd5dd80adf2d82c35c3bda88239 (diff)
downloadfocaccia-qemu-1e8fb7f1ee1ba902ab06cb8d54eca006c3b45f42.tar.gz
focaccia-qemu-1e8fb7f1ee1ba902ab06cb8d54eca006c3b45f42.zip
commit: Fix use of error handling policy
Commit implemented the 'enospc' policy as 'ignore' if the error was not
ENOSPC. The QAPI documentation promises that it's treated as 'stop'.
Using the common block job error handling function fixes this and also
adds the missing QMP event.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/commit.c b/block/commit.c
index 8b534d7c95..5d11eb6103 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -171,9 +171,9 @@ wait:
             bytes_written += n * BDRV_SECTOR_SIZE;
         }
         if (ret < 0) {
-            if (s->on_error == BLOCKDEV_ON_ERROR_STOP ||
-                s->on_error == BLOCKDEV_ON_ERROR_REPORT||
-                (s->on_error == BLOCKDEV_ON_ERROR_ENOSPC && ret == -ENOSPC)) {
+            BlockErrorAction action =
+                block_job_error_action(&s->common, false, s->on_error, -ret);
+            if (action == BLOCK_ERROR_ACTION_REPORT) {
                 goto out;
             } else {
                 n = 0;