4 * Copyright Red Hat, Inc. 2012
7 * Paolo Bonzini <pbonzini@redhat.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2 or later.
10 * See the COPYING.LIB file in the top-level directory.
15 #include "block/blockjob.h"
16 #include "block/block_int.h"
17 #include "qemu/ratelimit.h"
18 #include "qemu/bitmap.h"
20 #define SLICE_TIME 100000000ULL /* ns */
21 #define MAX_IN_FLIGHT 16
23 /* The mirroring buffer is a list of granularity-sized chunks.
24 * Free chunks are organized in a list.
26 typedef struct MirrorBuffer
{
27 QSIMPLEQ_ENTRY(MirrorBuffer
) next
;
30 typedef struct MirrorBlockJob
{
33 BlockDriverState
*target
;
34 BlockDriverState
*base
;
35 /* The name of the graph node to replace */
37 /* The BDS to replace */
38 BlockDriverState
*to_replace
;
39 /* Used to block operations on the drive-mirror-replace target */
40 Error
*replace_blocker
;
42 BlockdevOnError on_source_error
, on_target_error
;
48 unsigned long *cow_bitmap
;
49 BdrvDirtyBitmap
*dirty_bitmap
;
52 QSIMPLEQ_HEAD(, MirrorBuffer
) buf_free
;
55 unsigned long *in_flight_bitmap
;
60 typedef struct MirrorOp
{
67 static BlockErrorAction
mirror_error_action(MirrorBlockJob
*s
, bool read
,
72 return block_job_error_action(&s
->common
, s
->common
.bs
,
73 s
->on_source_error
, true, error
);
75 return block_job_error_action(&s
->common
, s
->target
,
76 s
->on_target_error
, false, error
);
80 static void mirror_iteration_done(MirrorOp
*op
, int ret
)
82 MirrorBlockJob
*s
= op
->s
;
85 int i
, nb_chunks
, sectors_per_chunk
;
87 trace_mirror_iteration_done(s
, op
->sector_num
, op
->nb_sectors
, ret
);
91 for (i
= 0; i
< op
->qiov
.niov
; i
++) {
92 MirrorBuffer
*buf
= (MirrorBuffer
*) iov
[i
].iov_base
;
93 QSIMPLEQ_INSERT_TAIL(&s
->buf_free
, buf
, next
);
97 sectors_per_chunk
= s
->granularity
>> BDRV_SECTOR_BITS
;
98 chunk_num
= op
->sector_num
/ sectors_per_chunk
;
99 nb_chunks
= op
->nb_sectors
/ sectors_per_chunk
;
100 bitmap_clear(s
->in_flight_bitmap
, chunk_num
, nb_chunks
);
101 if (s
->cow_bitmap
&& ret
>= 0) {
102 bitmap_set(s
->cow_bitmap
, chunk_num
, nb_chunks
);
105 qemu_iovec_destroy(&op
->qiov
);
106 g_slice_free(MirrorOp
, op
);
108 /* Enter coroutine when it is not sleeping. The coroutine sleeps to
109 * rate-limit itself. The coroutine will eventually resume since there is
110 * a sleep timeout so don't wake it early.
112 if (s
->common
.busy
) {
113 qemu_coroutine_enter(s
->common
.co
, NULL
);
117 static void mirror_write_complete(void *opaque
, int ret
)
119 MirrorOp
*op
= opaque
;
120 MirrorBlockJob
*s
= op
->s
;
122 BlockDriverState
*source
= s
->common
.bs
;
123 BlockErrorAction action
;
125 bdrv_set_dirty(source
, op
->sector_num
, op
->nb_sectors
);
126 action
= mirror_error_action(s
, false, -ret
);
127 if (action
== BLOCK_ERROR_ACTION_REPORT
&& s
->ret
>= 0) {
131 mirror_iteration_done(op
, ret
);
134 static void mirror_read_complete(void *opaque
, int ret
)
136 MirrorOp
*op
= opaque
;
137 MirrorBlockJob
*s
= op
->s
;
139 BlockDriverState
*source
= s
->common
.bs
;
140 BlockErrorAction action
;
142 bdrv_set_dirty(source
, op
->sector_num
, op
->nb_sectors
);
143 action
= mirror_error_action(s
, true, -ret
);
144 if (action
== BLOCK_ERROR_ACTION_REPORT
&& s
->ret
>= 0) {
148 mirror_iteration_done(op
, ret
);
151 bdrv_aio_writev(s
->target
, op
->sector_num
, &op
->qiov
, op
->nb_sectors
,
152 mirror_write_complete
, op
);
155 static uint64_t coroutine_fn
mirror_iteration(MirrorBlockJob
*s
)
157 BlockDriverState
*source
= s
->common
.bs
;
158 int nb_sectors
, sectors_per_chunk
, nb_chunks
;
159 int64_t end
, sector_num
, next_chunk
, next_sector
, hbitmap_next_sector
;
163 s
->sector_num
= hbitmap_iter_next(&s
->hbi
);
164 if (s
->sector_num
< 0) {
165 bdrv_dirty_iter_init(source
, s
->dirty_bitmap
, &s
->hbi
);
166 s
->sector_num
= hbitmap_iter_next(&s
->hbi
);
167 trace_mirror_restart_iter(s
,
168 bdrv_get_dirty_count(source
, s
->dirty_bitmap
));
169 assert(s
->sector_num
>= 0);
172 hbitmap_next_sector
= s
->sector_num
;
173 sector_num
= s
->sector_num
;
174 sectors_per_chunk
= s
->granularity
>> BDRV_SECTOR_BITS
;
175 end
= s
->common
.len
>> BDRV_SECTOR_BITS
;
177 /* Extend the QEMUIOVector to include all adjacent blocks that will
178 * be copied in this operation.
180 * We have to do this if we have no backing file yet in the destination,
181 * and the cluster size is very large. Then we need to do COW ourselves.
182 * The first time a cluster is copied, copy it entirely. Note that,
183 * because both the granularity and the cluster size are powers of two,
184 * the number of sectors to copy cannot exceed one cluster.
186 * We also want to extend the QEMUIOVector to include more adjacent
187 * dirty blocks if possible, to limit the number of I/O operations and
188 * run efficiently even with a small granularity.
192 next_sector
= sector_num
;
193 next_chunk
= sector_num
/ sectors_per_chunk
;
195 /* Wait for I/O to this cluster (from a previous iteration) to be done. */
196 while (test_bit(next_chunk
, s
->in_flight_bitmap
)) {
197 trace_mirror_yield_in_flight(s
, sector_num
, s
->in_flight
);
198 qemu_coroutine_yield();
202 int added_sectors
, added_chunks
;
204 if (!bdrv_get_dirty(source
, s
->dirty_bitmap
, next_sector
) ||
205 test_bit(next_chunk
, s
->in_flight_bitmap
)) {
206 assert(nb_sectors
> 0);
210 added_sectors
= sectors_per_chunk
;
211 if (s
->cow_bitmap
&& !test_bit(next_chunk
, s
->cow_bitmap
)) {
212 bdrv_round_to_clusters(s
->target
,
213 next_sector
, added_sectors
,
214 &next_sector
, &added_sectors
);
216 /* On the first iteration, the rounding may make us copy
217 * sectors before the first dirty one.
219 if (next_sector
< sector_num
) {
220 assert(nb_sectors
== 0);
221 sector_num
= next_sector
;
222 next_chunk
= next_sector
/ sectors_per_chunk
;
226 added_sectors
= MIN(added_sectors
, end
- (sector_num
+ nb_sectors
));
227 added_chunks
= (added_sectors
+ sectors_per_chunk
- 1) / sectors_per_chunk
;
229 /* When doing COW, it may happen that there is not enough space for
230 * a full cluster. Wait if that is the case.
232 while (nb_chunks
== 0 && s
->buf_free_count
< added_chunks
) {
233 trace_mirror_yield_buf_busy(s
, nb_chunks
, s
->in_flight
);
234 qemu_coroutine_yield();
236 if (s
->buf_free_count
< nb_chunks
+ added_chunks
) {
237 trace_mirror_break_buf_busy(s
, nb_chunks
, s
->in_flight
);
241 /* We have enough free space to copy these sectors. */
242 bitmap_set(s
->in_flight_bitmap
, next_chunk
, added_chunks
);
244 nb_sectors
+= added_sectors
;
245 nb_chunks
+= added_chunks
;
246 next_sector
+= added_sectors
;
247 next_chunk
+= added_chunks
;
248 if (!s
->synced
&& s
->common
.speed
) {
249 delay_ns
= ratelimit_calculate_delay(&s
->limit
, added_sectors
);
253 } while (delay_ns
== 0 && next_sector
< end
);
255 /* Allocate a MirrorOp that is used as an AIO callback. */
256 op
= g_slice_new(MirrorOp
);
258 op
->sector_num
= sector_num
;
259 op
->nb_sectors
= nb_sectors
;
261 /* Now make a QEMUIOVector taking enough granularity-sized chunks
264 qemu_iovec_init(&op
->qiov
, nb_chunks
);
265 next_sector
= sector_num
;
266 while (nb_chunks
-- > 0) {
267 MirrorBuffer
*buf
= QSIMPLEQ_FIRST(&s
->buf_free
);
268 size_t remaining
= (nb_sectors
* BDRV_SECTOR_SIZE
) - op
->qiov
.size
;
270 QSIMPLEQ_REMOVE_HEAD(&s
->buf_free
, next
);
272 qemu_iovec_add(&op
->qiov
, buf
, MIN(s
->granularity
, remaining
));
274 /* Advance the HBitmapIter in parallel, so that we do not examine
275 * the same sector twice.
277 if (next_sector
> hbitmap_next_sector
278 && bdrv_get_dirty(source
, s
->dirty_bitmap
, next_sector
)) {
279 hbitmap_next_sector
= hbitmap_iter_next(&s
->hbi
);
282 next_sector
+= sectors_per_chunk
;
285 bdrv_reset_dirty(source
, sector_num
, nb_sectors
);
287 /* Copy the dirty cluster. */
289 trace_mirror_one_iteration(s
, sector_num
, nb_sectors
);
290 bdrv_aio_readv(source
, sector_num
, &op
->qiov
, nb_sectors
,
291 mirror_read_complete
, op
);
295 static void mirror_free_init(MirrorBlockJob
*s
)
297 int granularity
= s
->granularity
;
298 size_t buf_size
= s
->buf_size
;
299 uint8_t *buf
= s
->buf
;
301 assert(s
->buf_free_count
== 0);
302 QSIMPLEQ_INIT(&s
->buf_free
);
303 while (buf_size
!= 0) {
304 MirrorBuffer
*cur
= (MirrorBuffer
*)buf
;
305 QSIMPLEQ_INSERT_TAIL(&s
->buf_free
, cur
, next
);
307 buf_size
-= granularity
;
312 static void mirror_drain(MirrorBlockJob
*s
)
314 while (s
->in_flight
> 0) {
315 qemu_coroutine_yield();
319 static void coroutine_fn
mirror_run(void *opaque
)
321 MirrorBlockJob
*s
= opaque
;
322 BlockDriverState
*bs
= s
->common
.bs
;
323 int64_t sector_num
, end
, sectors_per_chunk
, length
;
324 uint64_t last_pause_ns
;
326 char backing_filename
[1024];
330 if (block_job_is_cancelled(&s
->common
)) {
334 s
->common
.len
= bdrv_getlength(bs
);
335 if (s
->common
.len
< 0) {
338 } else if (s
->common
.len
== 0) {
339 /* Report BLOCK_JOB_READY and wait for complete. */
340 block_job_event_ready(&s
->common
);
342 while (!block_job_is_cancelled(&s
->common
) && !s
->should_complete
) {
343 block_job_yield(&s
->common
);
345 s
->common
.cancelled
= false;
349 length
= DIV_ROUND_UP(s
->common
.len
, s
->granularity
);
350 s
->in_flight_bitmap
= bitmap_new(length
);
352 /* If we have no backing file yet in the destination, we cannot let
353 * the destination do COW. Instead, we copy sectors around the
354 * dirty data if needed. We need a bitmap to do that.
356 bdrv_get_backing_filename(s
->target
, backing_filename
,
357 sizeof(backing_filename
));
358 if (backing_filename
[0] && !s
->target
->backing_hd
) {
359 ret
= bdrv_get_info(s
->target
, &bdi
);
363 if (s
->granularity
< bdi
.cluster_size
) {
364 s
->buf_size
= MAX(s
->buf_size
, bdi
.cluster_size
);
365 s
->cow_bitmap
= bitmap_new(length
);
369 end
= s
->common
.len
>> BDRV_SECTOR_BITS
;
370 s
->buf
= qemu_try_blockalign(bs
, s
->buf_size
);
371 if (s
->buf
== NULL
) {
376 sectors_per_chunk
= s
->granularity
>> BDRV_SECTOR_BITS
;
379 if (!s
->is_none_mode
) {
380 /* First part, loop on the sectors and initialize the dirty bitmap. */
381 BlockDriverState
*base
= s
->base
;
382 for (sector_num
= 0; sector_num
< end
; ) {
383 int64_t next
= (sector_num
| (sectors_per_chunk
- 1)) + 1;
384 ret
= bdrv_is_allocated_above(bs
, base
,
385 sector_num
, next
- sector_num
, &n
);
393 bdrv_set_dirty(bs
, sector_num
, n
);
401 bdrv_dirty_iter_init(bs
, s
->dirty_bitmap
, &s
->hbi
);
402 last_pause_ns
= qemu_clock_get_ns(QEMU_CLOCK_REALTIME
);
404 uint64_t delay_ns
= 0;
406 bool should_complete
;
413 cnt
= bdrv_get_dirty_count(bs
, s
->dirty_bitmap
);
415 /* Note that even when no rate limit is applied we need to yield
416 * periodically with no pending I/O so that qemu_aio_flush() returns.
417 * We do so every SLICE_TIME nanoseconds, or when there is an error,
418 * or when the source is clean, whichever comes first.
420 if (qemu_clock_get_ns(QEMU_CLOCK_REALTIME
) - last_pause_ns
< SLICE_TIME
&&
421 s
->common
.iostatus
== BLOCK_DEVICE_IO_STATUS_OK
) {
422 if (s
->in_flight
== MAX_IN_FLIGHT
|| s
->buf_free_count
== 0 ||
423 (cnt
== 0 && s
->in_flight
> 0)) {
424 trace_mirror_yield(s
, s
->in_flight
, s
->buf_free_count
, cnt
);
425 qemu_coroutine_yield();
427 } else if (cnt
!= 0) {
428 delay_ns
= mirror_iteration(s
);
435 should_complete
= false;
436 if (s
->in_flight
== 0 && cnt
== 0) {
437 trace_mirror_before_flush(s
);
438 ret
= bdrv_flush(s
->target
);
440 if (mirror_error_action(s
, false, -ret
) ==
441 BLOCK_ERROR_ACTION_REPORT
) {
445 /* We're out of the streaming phase. From now on, if the job
446 * is cancelled we will actually complete all pending I/O and
447 * report completion. This way, block-job-cancel will leave
448 * the target in a consistent state.
450 s
->common
.offset
= end
* BDRV_SECTOR_SIZE
;
452 block_job_event_ready(&s
->common
);
456 should_complete
= s
->should_complete
||
457 block_job_is_cancelled(&s
->common
);
458 cnt
= bdrv_get_dirty_count(bs
, s
->dirty_bitmap
);
462 if (cnt
== 0 && should_complete
) {
463 /* The dirty bitmap is not updated while operations are pending.
464 * If we're about to exit, wait for pending operations before
465 * calling bdrv_get_dirty_count(bs), or we may exit while the
466 * source has dirty data to copy!
468 * Note that I/O can be submitted by the guest while
469 * mirror_populate runs.
471 trace_mirror_before_drain(s
, cnt
);
473 cnt
= bdrv_get_dirty_count(bs
, s
->dirty_bitmap
);
477 trace_mirror_before_sleep(s
, cnt
, s
->synced
, delay_ns
);
479 /* Publish progress */
480 s
->common
.offset
= (end
- cnt
) * BDRV_SECTOR_SIZE
;
481 block_job_sleep_ns(&s
->common
, QEMU_CLOCK_REALTIME
, delay_ns
);
482 if (block_job_is_cancelled(&s
->common
)) {
485 } else if (!should_complete
) {
486 delay_ns
= (s
->in_flight
== 0 && cnt
== 0 ? SLICE_TIME
: 0);
487 block_job_sleep_ns(&s
->common
, QEMU_CLOCK_REALTIME
, delay_ns
);
488 } else if (cnt
== 0) {
489 /* The two disks are in sync. Exit and report successful
492 assert(QLIST_EMPTY(&bs
->tracked_requests
));
493 s
->common
.cancelled
= false;
496 last_pause_ns
= qemu_clock_get_ns(QEMU_CLOCK_REALTIME
);
500 if (s
->in_flight
> 0) {
501 /* We get here only if something went wrong. Either the job failed,
502 * or it was cancelled prematurely so that we do not guarantee that
503 * the target is a copy of the source.
505 assert(ret
< 0 || (!s
->synced
&& block_job_is_cancelled(&s
->common
)));
509 assert(s
->in_flight
== 0);
511 g_free(s
->cow_bitmap
);
512 g_free(s
->in_flight_bitmap
);
513 bdrv_release_dirty_bitmap(bs
, s
->dirty_bitmap
);
514 bdrv_iostatus_disable(s
->target
);
515 if (s
->should_complete
&& ret
== 0) {
516 BlockDriverState
*to_replace
= s
->common
.bs
;
518 to_replace
= s
->to_replace
;
520 if (bdrv_get_flags(s
->target
) != bdrv_get_flags(to_replace
)) {
521 bdrv_reopen(s
->target
, bdrv_get_flags(to_replace
), NULL
);
523 bdrv_swap(s
->target
, to_replace
);
524 if (s
->common
.driver
->job_type
== BLOCK_JOB_TYPE_COMMIT
) {
525 /* drop the bs loop chain formed by the swap: break the loop then
526 * trigger the unref from the top one */
527 BlockDriverState
*p
= s
->base
->backing_hd
;
528 bdrv_set_backing_hd(s
->base
, NULL
);
533 bdrv_op_unblock_all(s
->to_replace
, s
->replace_blocker
);
534 error_free(s
->replace_blocker
);
535 bdrv_unref(s
->to_replace
);
538 bdrv_unref(s
->target
);
539 block_job_completed(&s
->common
, ret
);
542 static void mirror_set_speed(BlockJob
*job
, int64_t speed
, Error
**errp
)
544 MirrorBlockJob
*s
= container_of(job
, MirrorBlockJob
, common
);
547 error_set(errp
, QERR_INVALID_PARAMETER
, "speed");
550 ratelimit_set_speed(&s
->limit
, speed
/ BDRV_SECTOR_SIZE
, SLICE_TIME
);
553 static void mirror_iostatus_reset(BlockJob
*job
)
555 MirrorBlockJob
*s
= container_of(job
, MirrorBlockJob
, common
);
557 bdrv_iostatus_reset(s
->target
);
560 static void mirror_complete(BlockJob
*job
, Error
**errp
)
562 MirrorBlockJob
*s
= container_of(job
, MirrorBlockJob
, common
);
563 Error
*local_err
= NULL
;
566 ret
= bdrv_open_backing_file(s
->target
, NULL
, &local_err
);
568 error_propagate(errp
, local_err
);
572 error_set(errp
, QERR_BLOCK_JOB_NOT_READY
, job
->bs
->device_name
);
576 /* check the target bs is not blocked and block all operations on it */
578 s
->to_replace
= check_to_replace_node(s
->replaces
, &local_err
);
579 if (!s
->to_replace
) {
580 error_propagate(errp
, local_err
);
584 error_setg(&s
->replace_blocker
,
585 "block device is in use by block-job-complete");
586 bdrv_op_block_all(s
->to_replace
, s
->replace_blocker
);
587 bdrv_ref(s
->to_replace
);
590 s
->should_complete
= true;
591 block_job_resume(job
);
594 static const BlockJobDriver mirror_job_driver
= {
595 .instance_size
= sizeof(MirrorBlockJob
),
596 .job_type
= BLOCK_JOB_TYPE_MIRROR
,
597 .set_speed
= mirror_set_speed
,
598 .iostatus_reset
= mirror_iostatus_reset
,
599 .complete
= mirror_complete
,
602 static const BlockJobDriver commit_active_job_driver
= {
603 .instance_size
= sizeof(MirrorBlockJob
),
604 .job_type
= BLOCK_JOB_TYPE_COMMIT
,
605 .set_speed
= mirror_set_speed
,
607 = mirror_iostatus_reset
,
608 .complete
= mirror_complete
,
611 static void mirror_start_job(BlockDriverState
*bs
, BlockDriverState
*target
,
612 const char *replaces
,
613 int64_t speed
, int64_t granularity
,
615 BlockdevOnError on_source_error
,
616 BlockdevOnError on_target_error
,
617 BlockDriverCompletionFunc
*cb
,
618 void *opaque
, Error
**errp
,
619 const BlockJobDriver
*driver
,
620 bool is_none_mode
, BlockDriverState
*base
)
624 if (granularity
== 0) {
625 /* Choose the default granularity based on the target file's cluster
626 * size, clamped between 4k and 64k. */
628 if (bdrv_get_info(target
, &bdi
) >= 0 && bdi
.cluster_size
!= 0) {
629 granularity
= MAX(4096, bdi
.cluster_size
);
630 granularity
= MIN(65536, granularity
);
636 assert ((granularity
& (granularity
- 1)) == 0);
638 if ((on_source_error
== BLOCKDEV_ON_ERROR_STOP
||
639 on_source_error
== BLOCKDEV_ON_ERROR_ENOSPC
) &&
640 !bdrv_iostatus_is_enabled(bs
)) {
641 error_set(errp
, QERR_INVALID_PARAMETER
, "on-source-error");
646 s
= block_job_create(driver
, bs
, speed
, cb
, opaque
, errp
);
651 s
->replaces
= g_strdup(replaces
);
652 s
->on_source_error
= on_source_error
;
653 s
->on_target_error
= on_target_error
;
655 s
->is_none_mode
= is_none_mode
;
657 s
->granularity
= granularity
;
658 s
->buf_size
= MAX(buf_size
, granularity
);
660 s
->dirty_bitmap
= bdrv_create_dirty_bitmap(bs
, granularity
, errp
);
661 if (!s
->dirty_bitmap
) {
664 bdrv_set_enable_write_cache(s
->target
, true);
665 bdrv_set_on_error(s
->target
, on_target_error
, on_target_error
);
666 bdrv_iostatus_enable(s
->target
);
667 s
->common
.co
= qemu_coroutine_create(mirror_run
);
668 trace_mirror_start(bs
, s
, s
->common
.co
, opaque
);
669 qemu_coroutine_enter(s
->common
.co
, s
);
672 void mirror_start(BlockDriverState
*bs
, BlockDriverState
*target
,
673 const char *replaces
,
674 int64_t speed
, int64_t granularity
, int64_t buf_size
,
675 MirrorSyncMode mode
, BlockdevOnError on_source_error
,
676 BlockdevOnError on_target_error
,
677 BlockDriverCompletionFunc
*cb
,
678 void *opaque
, Error
**errp
)
681 BlockDriverState
*base
;
683 is_none_mode
= mode
== MIRROR_SYNC_MODE_NONE
;
684 base
= mode
== MIRROR_SYNC_MODE_TOP
? bs
->backing_hd
: NULL
;
685 mirror_start_job(bs
, target
, replaces
,
686 speed
, granularity
, buf_size
,
687 on_source_error
, on_target_error
, cb
, opaque
, errp
,
688 &mirror_job_driver
, is_none_mode
, base
);
691 void commit_active_start(BlockDriverState
*bs
, BlockDriverState
*base
,
693 BlockdevOnError on_error
,
694 BlockDriverCompletionFunc
*cb
,
695 void *opaque
, Error
**errp
)
697 int64_t length
, base_length
;
700 Error
*local_err
= NULL
;
702 orig_base_flags
= bdrv_get_flags(base
);
704 if (bdrv_reopen(base
, bs
->open_flags
, errp
)) {
708 length
= bdrv_getlength(bs
);
710 error_setg_errno(errp
, -length
,
711 "Unable to determine length of %s", bs
->filename
);
712 goto error_restore_flags
;
715 base_length
= bdrv_getlength(base
);
716 if (base_length
< 0) {
717 error_setg_errno(errp
, -base_length
,
718 "Unable to determine length of %s", base
->filename
);
719 goto error_restore_flags
;
722 if (length
> base_length
) {
723 ret
= bdrv_truncate(base
, length
);
725 error_setg_errno(errp
, -ret
,
726 "Top image %s is larger than base image %s, and "
727 "resize of base image failed",
728 bs
->filename
, base
->filename
);
729 goto error_restore_flags
;
734 mirror_start_job(bs
, base
, NULL
, speed
, 0, 0,
735 on_error
, on_error
, cb
, opaque
, &local_err
,
736 &commit_active_job_driver
, false, base
);
738 error_propagate(errp
, local_err
);
739 goto error_restore_flags
;
745 /* ignore error and errp for bdrv_reopen, because we want to propagate
746 * the original error */
747 bdrv_reopen(base
, orig_base_flags
, NULL
);