Fix incorrect state information for migrate_cancel
PATCH 1/1 Fix incorrect state information for migrate_cancel
In qemu-1.4.x, When performing migrate_cancel on hmp, Sometimes s->state is incorrrectly saved to MIG_STATE_ERROR instead of MIG_STATE_CANCELLED.
If the migrate_fd_cancel in main thread is scheduled to run before the thread buffered_file_thread calls migrate_fd_put_buffer, The s->state will be modified to MIG_STATE_CANCELLED by main thread, Then the migrate_fd_put_buffer in thread buffered_file_thread will return -EIO if s->state != MIG_STATE_ACTIVE, This incorrect return value trigged migrate_fd_error to set s->state = MIG_STATE_ERROR.
This patch fixes the issue in qemu-1.4.x.
--- migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration.c +1 -1
@@ -751,7 +751,7 @@ static void *buffered_file_thread(void *opaque) } out: -if (ret <0 ) { +if (ret <0 && !s->complete) {migrate_fd_error (s); }g_free (s->buffer);
Signature · 1 line
1.8.4
Quoted 4 lines · On Thu, 05 Dec 2013 18:49:15 -0700 "Lin Ma" <[email protected]> wrote:
In qemu-1.4.x, When performing
migrate_cancelon hmp, Sometimess->stateis incorrrectly saved toMIG_STATE_ERRORinstead ofMIG_STATE_CANCELLED.
Quoted 8 lines
If the
migrate_fd_cancelin main thread is scheduled to run before the threadbuffered_file_threadcallsmigrate_fd_put_buffer, Thes->statewill be modified toMIG_STATE_CANCELLEDby main thread, Then themigrate_fd_put_bufferin threadbuffered_file_threadwill return-EIOifs->state!=MIG_STATE_ACTIVE, This incorrect return value triggedmigrate_fd_errorto sets->state=MIG_STATE_ERROR.This patch fixes the issue in qemu-1.4.x.
Is qemu 1.4 still maintained?
Quoted 19 lines
Signed-off-by Lin Ma <[email protected]>--- migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration.c +1
-1@@ -751,7 +751,7 @@ static void *buffered_file_thread(void *opaque) } out: -if (ret <0 ) { +if (ret <0 && !s->complete) {migrate_fd_error (s); }g_free (s->buffer);