diff options
author | Eric Blake <eblake@redhat.com> | 2017-03-08 15:34:27 -0600 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-03-13 12:49:33 +0100 |
commit | 666a9543fa957169b6e25805aac88ca72c08f0b5 (patch) | |
tree | 59cf70016f77e3666fa27e86acbd8427c97693bf /block/backup.c | |
parent | e32ccbc6e9ff95330e916fd72c541894d440fcd5 (diff) |
backup: React to bdrv_is_allocated() errors
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 <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/backup.c')
-rw-r--r-- | block/backup.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/block/backup.c b/block/backup.c index d3d20dbcb0..a4fb2884f9 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 = |