]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
migration: push qemu_savevm_state_cancel out of qemu_savevm_state_*
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Feb 2013 16:36:10 +0000 (17:36 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 11 Mar 2013 12:32:00 +0000 (13:32 +0100)
This is useful, because it lets us keep the cancellation callbacks
inside the big lock while pushing the others out.

Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
savevm.c

index a8a53efc9bcec800dcd4d4e266b2ecad41f99584..4302903e7cbfcdf7713f84f29c455cff293a1a27 100644 (file)
--- a/savevm.c
+++ b/savevm.c
@@ -1621,17 +1621,11 @@ int qemu_savevm_state_begin(QEMUFile *f,
 
         ret = se->ops->save_live_setup(f, se->opaque);
         if (ret < 0) {
-            qemu_savevm_state_cancel();
             return ret;
         }
     }
     ret = qemu_file_get_error(f);
-    if (ret != 0) {
-        qemu_savevm_state_cancel();
-    }
-
     return ret;
-
 }
 
 /*
@@ -1677,9 +1671,6 @@ int qemu_savevm_state_iterate(QEMUFile *f)
         return ret;
     }
     ret = qemu_file_get_error(f);
-    if (ret != 0) {
-        qemu_savevm_state_cancel();
-    }
     return ret;
 }
 
@@ -1778,8 +1769,7 @@ static int qemu_savevm_state(QEMUFile *f)
     };
 
     if (qemu_savevm_state_blocked(NULL)) {
-        ret = -EINVAL;
-        goto out;
+        return -EINVAL;
     }
 
     ret = qemu_savevm_state_begin(f, &params);
@@ -1798,6 +1788,9 @@ out:
     if (ret == 0) {
         ret = qemu_file_get_error(f);
     }
+    if (ret != 0) {
+        qemu_savevm_state_cancel();
+    }
 
     return ret;
 }