commit: Fix use of error handling policy
authorKevin Wolf <kwolf@redhat.com>
Wed, 29 Jun 2016 15:38:57 +0000 (17:38 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 13 Jul 2016 11:32:27 +0000 (13:32 +0200)
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>
block/commit.c

index 8b534d7c95cb0e20f36e026fb96802afd78a3e3c..5d11eb6103b5bb8f92d52ba567c3181c4b8f0c16 100644 (file)
@@ -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;