On 14/10/2016 11:43, Fam Zheng wrote: > On Thu, 10/13 19:34, Paolo Bonzini wrote: >> Ensure that there are no changes between the last check to >> bdrv_get_dirty_count and the switch to the target. >> >> There is already a bdrv_drained_end call, we only need to ensure >> that bdrv_drained_begin is not called twice. >> >> Cc: qemu-sta...@nongnu.org > > Cc stable? I don't see an existing bug here, can you explain?
Hmm, I was not sure that mirror was safe for dataplane devices without the drained section, but it looks like there is no "hole". So no need to Cc stable. >> @@ -802,9 +812,10 @@ immediate_exit: >> >> data = g_malloc(sizeof(*data)); >> data->ret = ret; >> - /* Before we switch to target in mirror_exit, make sure data doesn't >> - * change. */ >> - bdrv_drained_begin(bs); >> + >> + if (need_drain) { > > Not sure whether this if block is necessary (i.e. when !(cnt == 0 && > should_complete)), but it certainly doesn't hurt. Yes, the alternative is to have something similar, to skip the bdrv_drained_end, in mirror_exit. Paolo >> + bdrv_drained_begin(bs); >> + } >> block_job_defer_to_main_loop(&s->common, mirror_exit, data); >> } >> >> -- >> 2.7.4 >> >> > > Fam >