]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Thaw filesystems if the snapshot commit message to VMX fails
authorOliver Kurth <okurth@vmware.com>
Thu, 19 Jan 2017 01:28:16 +0000 (17:28 -0800)
committerOliver Kurth <okurth@vmware.com>
Fri, 20 Jan 2017 03:09:02 +0000 (19:09 -0800)
open-vm-tools/services/plugins/vmbackup/syncDriverOps.c

index 19afb35511cd4e62814bd71899ec8810bd2df92d..2c5c4fb53b62ec1c011e3432e0d9349b672474cf 100644 (file)
@@ -61,10 +61,10 @@ typedef struct VmBackupDriverOp {
  */
 
 static Bool
-VmBackupDriverThaw(VmBackupDriverOp *op)
+VmBackupDriverThaw(SyncDriverHandle *handle)
 {
-   Bool success = SyncDriver_Thaw(*op->syncHandle);
-   SyncDriver_CloseHandle(op->syncHandle);
+   Bool success = SyncDriver_Thaw(*handle);
+   SyncDriver_CloseHandle(handle);
    return success;
 }
 
@@ -106,7 +106,7 @@ VmBackupDriverOpQuery(VmBackupOp *_op) // IN
 
       case SYNCDRIVER_IDLE:
          if (op->canceled) {
-            VmBackupDriverThaw(op);
+            VmBackupDriverThaw(op->syncHandle);
          }
          /*
           * This prevents the release callback from freeing the handle, which
@@ -117,7 +117,7 @@ VmBackupDriverOpQuery(VmBackupOp *_op) // IN
          break;
 
       default:
-         VmBackupDriverThaw(op);
+         VmBackupDriverThaw(op->syncHandle);
          ret = VMBACKUP_STATUS_ERROR;
          break;
       }
@@ -231,7 +231,7 @@ VmBackupNewDriverOp(VmBackupState *state,       // IN
                                   state->enableNullDriver : FALSE,
                                   op->syncHandle);
    } else {
-      success = VmBackupDriverThaw(op);
+      success = VmBackupDriverThaw(op->syncHandle);
    }
    if (!success) {
       g_warning("Error %s filesystems.", freeze ? "freezing" : "thawing");
@@ -264,15 +264,24 @@ VmBackupNewDriverOp(VmBackupState *state,       // IN
 static Bool
 VmBackupSyncDriverReadyForSnapshot(VmBackupState *state)
 {
-   Bool success;
    SyncDriverHandle *handle = state->clientData;
 
    g_debug("*** %s\n", __FUNCTION__);
    if (handle != NULL && *handle != SYNCDRIVER_INVALID_HANDLE) {
+      Bool success;
       success = VmBackup_SendEvent(VMBACKUP_EVENT_SNAPSHOT_COMMIT, 0, "");
       if (success) {
          state->freezeStatus = VMBACKUP_FREEZE_FINISHED;
       } else {
+         /*
+          * If the vmx does not know this event (e.g. due to an RPC timeout),
+          * then filesystems need to be thawed here because snapshotDone
+          * will not be sent by the vmx.
+          */
+         g_debug("VMX state changed; thawing filesystems.\n");
+         if (!VmBackupDriverThaw(handle)) {
+            g_warning("Error thawing filesystems.\n");
+         }
          state->freezeStatus = VMBACKUP_FREEZE_ERROR;
       }
       return success;