|
@@ -576,8 +576,10 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
|
|
|
} else if (ret >= 0 && !(ret & BDRV_BLOCK_DATA)) {
|
|
|
int64_t target_offset;
|
|
|
int64_t target_bytes;
|
|
|
- bdrv_round_to_clusters(blk_bs(s->target), offset, io_bytes,
|
|
|
- &target_offset, &target_bytes);
|
|
|
+ WITH_GRAPH_RDLOCK_GUARD() {
|
|
|
+ bdrv_round_to_clusters(blk_bs(s->target), offset, io_bytes,
|
|
|
+ &target_offset, &target_bytes);
|
|
|
+ }
|
|
|
if (target_offset == offset &&
|
|
|
target_bytes == io_bytes) {
|
|
|
mirror_method = ret & BDRV_BLOCK_ZERO ?
|
|
@@ -966,11 +968,13 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
|
|
|
*/
|
|
|
bdrv_get_backing_filename(target_bs, backing_filename,
|
|
|
sizeof(backing_filename));
|
|
|
+ bdrv_graph_co_rdlock();
|
|
|
if (!bdrv_co_get_info(target_bs, &bdi) && bdi.cluster_size) {
|
|
|
s->target_cluster_size = bdi.cluster_size;
|
|
|
} else {
|
|
|
s->target_cluster_size = BDRV_SECTOR_SIZE;
|
|
|
}
|
|
|
+ bdrv_graph_co_rdunlock();
|
|
|
if (backing_filename[0] && !bdrv_backing_chain_next(target_bs) &&
|
|
|
s->granularity < s->target_cluster_size) {
|
|
|
s->buf_size = MAX(s->buf_size, s->target_cluster_size);
|