On 03.08.23 05:43, Evanzhang wrote:
[...]
diff --git a/block/mirror.c b/block/mirror.c
index d3cacd1708..cd19b49f7f 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1143,6 +1143,10 @@ immediate_exit:
g_free(s->in_flight_bitmap);
bdrv_dirty_iter_free(s->dbi);
+ if (ret >= 0) {
+ ret = block_job_final_target_flush(&s->common, blk_bs(s->target));
+ }
+
if (need_drain) {
s->in_drain = true;
bdrv_drained_begin(bs);
hi,I use gdb tested drive-mirror,break block_job_final_target_flush,
mirror_run was not called it.
qmp command:
{"execute": "drive-mirror","arguments": {"device": "drive-virtio1","target":
"./data1.test","sync": "full"}}
Sorry for long answer. I"m going to resend a new version soon.
I now checked, and I see that block_job_final_target_flush() is called.
But it is called after executing block-job-complete command.
--- a/include/block/blockjob_int.h
+++ b/include/block/blockjob_int.h
@@ -152,4 +152,15 @@ void block_job_ratelimit_sleep(BlockJob *job);
BlockErrorAction block_job_error_action(BlockJob *job, BlockdevOnError on_err,
int is_read, int error);
+/**
+ * block_job_final_target_flush:
+ * @job: The job to signal an error for if flush failed.
+ * @target_bs: The bs to flush.
+ *
+ * The function is intended to be called at the end of .run() for any data
+ * copying job.
+ */
+int coroutine_fn
+block_job_final_target_flush(BlockJob *job, BlockDriverState *target_bs);
+
#endif
--
2.34.1
--
Best regards,
Vladimir