提交 685803fc 编写于 作者: K Kevin Wolf 提交者: Michael Roth

cpus: Let vm_stop[_force_state]() always flush block devices

Even if the VM is already stopped, we cannot assume that all data has
already been successfully flushed to disk. The flush during the previous
vm_stop() could have failed.

Run bdrv_flush_all() unconditionally so that we get an error each time
if the block device isn't really flushed.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 594a45ce)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 32d1d7ff
...@@ -446,11 +446,12 @@ static int do_vm_stop(RunState state) ...@@ -446,11 +446,12 @@ static int do_vm_stop(RunState state)
pause_all_vcpus(); pause_all_vcpus();
runstate_set(state); runstate_set(state);
vm_state_notify(0, state); vm_state_notify(0, state);
bdrv_drain_all();
ret = bdrv_flush_all();
monitor_protocol_event(QEVENT_STOP, NULL); monitor_protocol_event(QEVENT_STOP, NULL);
} }
bdrv_drain_all();
ret = bdrv_flush_all();
return ret; return ret;
} }
...@@ -1120,7 +1121,9 @@ int vm_stop_force_state(RunState state) ...@@ -1120,7 +1121,9 @@ int vm_stop_force_state(RunState state)
return vm_stop(state); return vm_stop(state);
} else { } else {
runstate_set(state); runstate_set(state);
return 0; /* Make sure to return an error if the flush in a previous vm_stop()
* failed. */
return bdrv_flush_all();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册