migration/colo.c: Add missed return in error handling
PATCH 1/1 migration/colo.c: Add missed return in error handling
When doing failover and checkpoint, some returns are missed in error handling. Let's add it.
--- migration/colo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
migration/colo.c +5 -2
@@ -94,12 +94,15 @@ static void secondary_vm_do_failover(void)if (local_err) {error_report_err (local_err); local_err =NULL ; +return ; }/* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event (COLO_EVENT_FAILOVER , &local_err);if (local_err) {error_report_err (local_err); + local_err =NULL ; +return ; }if (!autostart) {
@@ -178,6 +181,7 @@ static void primary_vm_do_failover(void)if (local_err) {error_report_err (local_err); local_err =NULL ; +return ; }/* Notify COLO thread that failover work is finished */
@@ -507,12 +511,11 @@ static int colo_do_checkpoint_transaction(MigrationState *s, goto out; } - ret =0 ; -qemu_mutex_lock_iothread ();vm_start ();qemu_mutex_unlock_iothread ();trace_colo_vm_state_change ("stop" ,"run" ); +return 0 ; out:if (local_err) {
Signature · 1 line
2.32.0
Quoted 10 lines
-----Original Message-----
From: Rao, Lei <[email protected]>
Sent: Tuesday, December 28, 2021 3:35 PM
To: Zhang, Chen <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Rao, Lei <[email protected]>
Subject: [PATCH]migration/colo.c: Add missed return in error handling
Quoted 4 lines
When doing failover and checkpoint, some returns are missed in error handling. Let's add it.
Signed-off-by Lei Rao <[email protected]>
Thanks
Chen
Quoted 48 lines
--- migration/colo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)migration/colo.c index 5f7071b3cd..014d3cba01 renamed from migration/colo.c +0
-0100644
migration/colo.c +4
-0@@ -94,12 +94,15 @@ static void secondary_vm_do_failover(void)if (local_err) {error_report_err (local_err); local_err =NULL ; +return ; }/* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event (COLO_EVENT_FAILOVER , &local_err);if (local_err) {error_report_err (local_err); + local_err =NULL ; +return ; }if (!autostart) {@@ -178,6 +181,7 @@ static void primary_vm_do_failover(void)if (local_err) {error_report_err (local_err); local_err =NULL ; +return ; } /* Notify COLO thread that failover work is finished */ @@ -507,12 +511,11@@ static int colo_do_checkpoint_transaction(MigrationState *s,
goto out; }migration/colo.c +1
-3- ret =0 ; -qemu_mutex_lock_iothread ();vm_start ();qemu_mutex_unlock_iothread ();trace_colo_vm_state_change ("stop" ,"run" ); +return 0 ; out:if (local_err) { --2.32.0
Quoted 13 lines · Rao Lei
When doing failover and checkpoint, some returns are missed in error handling. Let's add it.
Signed-off-by Lei Rao <[email protected]>--- migration/colo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)migration/colo.c +0
-0
migration/colo.c static void secondary_vm_do_failover(void) · line 97
Quoted 4 lines
migration/colo.c +1
-0@@ -94,12 +94,15 @@ static void secondary_vm_do_failover(void)if (local_err) {error_report_err (local_err); local_err =NULL ; +return ;
Assign a local variable before a return is a NOP, so remove the assignmenent?
migration/colo.c static void secondary_vm_do_failover(void) · line 105
Quoted 8 lines
migration/colo.c +2
-0}/* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event (COLO_EVENT_FAILOVER , &local_err);if (local_err) {error_report_err (local_err); + local_err =NULL ; +return ;
Same here.
migration/colo.c static void primary_vm_do_failover(void) · line 184
Quoted 8 lines
migration/colo.c +1
-0}if (!autostart) {@@ -178,6 +181,7 @@ static void primary_vm_do_failover(void)if (local_err) {error_report_err (local_err); local_err =NULL ; +return ;
And here.
Quoted 7 lines
migration/colo.c +0
-0}/* Notify COLO thread that failover work is finished */ @@ -507,12 +511,11 @@ static int colo_do_checkpoint_transaction(MigrationState *s, goto out; }
migration/colo.c static int colo_do_checkpoint_transaction(MigrationState *s, · line 521
Quoted 10 lines
migration/colo.c +1
-2- ret =0 ; -qemu_mutex_lock_iothread ();vm_start ();qemu_mutex_unlock_iothread ();trace_colo_vm_state_change ("stop" ,"run" ); +return 0 ; out:if (local_err) {
This is really a NOP, but it is one line less, so I will not complain.
But ther, it is better to just rename the label from "out" to "error" or something like that.
Later, Juan.