[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 04/12] backup: React to bdrv_is_allocated() errors
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 04/12] backup: React to bdrv_is_allocated() errors |
Date: |
Mon, 13 Mar 2017 15:55:00 +0100 |
From: Eric Blake <address@hidden>
If bdrv_is_allocated() fails, we should immediately do the backup
error action, rather than attempting backup_do_cow() (although
that will likely fail too).
Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/backup.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index d3d20db..a4fb288 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -468,13 +468,14 @@ static void coroutine_fn backup_run(void *opaque)
/* Both FULL and TOP SYNC_MODE's require copying.. */
for (; start < end; start++) {
bool error_is_read;
+ int alloced = 0;
+
if (yield_and_check(job)) {
break;
}
if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
int i, n;
- int alloced = 0;
/* Check to see if these blocks are already in the
* backing file. */
@@ -492,7 +493,7 @@ static void coroutine_fn backup_run(void *opaque)
sectors_per_cluster - i, &n);
i += n;
- if (alloced == 1 || n == 0) {
+ if (alloced || n == 0) {
break;
}
}
@@ -504,8 +505,13 @@ static void coroutine_fn backup_run(void *opaque)
}
}
/* FULL sync mode we copy the whole drive. */
- ret = backup_do_cow(job, start * sectors_per_cluster,
- sectors_per_cluster, &error_is_read, false);
+ if (alloced < 0) {
+ ret = alloced;
+ } else {
+ ret = backup_do_cow(job, start * sectors_per_cluster,
+ sectors_per_cluster, &error_is_read,
+ false);
+ }
if (ret < 0) {
/* Depending on error action, fail now or retry cluster */
BlockErrorAction action =
--
1.8.3.1
- [Qemu-block] [PULL 00/12] Block layer fixes for 2.9.0-rc1, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 01/12] backup: allow target without .bdrv_get_info, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 02/12] file-posix: Consider max_segments for BlockLimits.max_transfer, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 04/12] backup: React to bdrv_is_allocated() errors,
Kevin Wolf <=
- [Qemu-block] [PULL 05/12] vvfat: React to bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 06/12] migration: Document handling of bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 03/12] block: Drop unmaintained 'archipelago' driver, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 08/12] block: Request block status from *file for BDRV_BLOCK_RAW, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 10/12] block: Refresh filename after changing backing file, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 07/12] block: Remove check_new_perm from bdrv_replace_child(), Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 09/12] commit: Implement bdrv_commit_top.bdrv_co_get_block_status, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 11/12] mirror: Implement .bdrv_refresh_filename, Kevin Wolf, 2017/03/13
- [Qemu-block] [PULL 12/12] commit: Implement .bdrv_refresh_filename, Kevin Wolf, 2017/03/13
- Re: [Qemu-block] [Qemu-devel] [PULL 00/12] Block layer fixes for 2.9.0-rc1, Peter Maydell, 2017/03/13