hw/ppc/spapr: Make sure to close the htab_fd when migration is canceled
PATCH 1/1 hw/ppc/spapr: Make sure to close the htab_fd when migration is canceled
When canceling a migration process, we currently do not close the HTAB migration file descriptor since htab_save_complete() is never called in that case. So we leave the migration process with a dangling htab_fd value around, and this causes any further migration attempts to fail. To fix this issue, simply make sure that the htab_fd is closed during the migration cleanup stage. And since the cleanup() function is also called when migration succeeds, we can also remove the call to close_htab_fd() from the htab_save_complete() function.
--- hw/ppc/spapr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +8 -1
@@ -1512,7 +1512,6 @@ static int htab_save_complete(QEMUFile *f, void *opaque)if (rc <0 ) {return rc; } -close_htab_fd (spapr); }else {if (spapr->htab_first_pass) {htab_save_first_pass (f, spapr,-1 );
@@ -1614,10 +1613,18 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)return 0 ; } +static void htab_cleanup (void *opaque) +{ +sPAPRMachineState *spapr = opaque; + +close_htab_fd (spapr); +} +static SaveVMHandlers savevm_htab_handlers = { .save_live_setup = htab_save_setup, .save_live_iterate = htab_save_iterate, .save_live_complete_precopy = htab_save_complete, + .cleanup = htab_cleanup, .load_state = htab_load, };
Signature · 1 line
1.8.3.1
Quoted 10 lines · On Thu, 21 Jul 2016 11:21:34 +0200 Thomas Huth <[email protected]> wrote:
When canceling a migration process, we currently do not close the HTAB migration file descriptor since
htab_save_complete()is never called in that case. So we leave the migration process with a danglinghtab_fdvalue around, and this causes any further migration attempts to fail. To fix this issue, simply make sure that thehtab_fdis closed during the migration cleanup stage. And since thecleanup()function is also called when migration succeeds, we can also remove the call toclose_htab_fd()from thehtab_save_complete()function.
Quoted 3 lines
Signed-off-by Thomas Huth <[email protected]>---
Quoted 34 lines
hw/ppc/spapr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)hw/ppc/spapr.c +8
-1@@ -1512,7 +1512,6 @@ static int htab_save_complete(QEMUFile *f, void *opaque)if (rc <0 ) {return rc; } -close_htab_fd (spapr); }else {if (spapr->htab_first_pass) {htab_save_first_pass (f, spapr,-1 );@@ -1614,10 +1613,18 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)return 0 ; } +static void htab_cleanup (void *opaque) +{ +sPAPRMachineState *spapr = opaque; + +close_htab_fd (spapr); +} +static SaveVMHandlers savevm_htab_handlers = { .save_live_setup = htab_save_setup, .save_live_iterate = htab_save_iterate, .save_live_complete_precopy = htab_save_complete, + .cleanup = htab_cleanup, .load_state = htab_load, };
David Gibson
AppliedQuoted 13 lines · Greg Kurz
Quoted 10 lines · On Thu, 21 Jul 2016 11:21:34 +0200 Thomas Huth <[email protected]> wrote:
When canceling a migration process, we currently do not close the HTAB migration file descriptor since
htab_save_complete()is never called in that case. So we leave the migration process with a danglinghtab_fdvalue around, and this causes any further migration attempts to fail. To fix this issue, simply make sure that thehtab_fdis closed during the migration cleanup stage. And since thecleanup()function is also called when migration succeeds, we can also remove the call toclose_htab_fd()from thehtab_save_complete()function.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Thomas Huth <[email protected]>---
Reviewed-by Greg Kurz <[email protected]>
Applied to ppc-for-2.7
Quoted 36 lines
Quoted 35 lines
hw/ppc/spapr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)hw/ppc/spapr.c +8
-1@@ -1512,7 +1512,6 @@ static int htab_save_complete(QEMUFile *f, void *opaque)if (rc <0 ) {return rc; } -close_htab_fd (spapr); }else {if (spapr->htab_first_pass) {htab_save_first_pass (f, spapr,-1 );@@ -1614,10 +1613,18 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)return 0 ; } +static void htab_cleanup (void *opaque) +{ +sPAPRMachineState *spapr = opaque; + +close_htab_fd (spapr); +} +static SaveVMHandlers savevm_htab_handlers = { .save_live_setup = htab_save_setup, .save_live_iterate = htab_save_iterate, .save_live_complete_precopy = htab_save_complete, + .cleanup = htab_cleanup, .load_state = htab_load, };
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson