From: Oliver Kurth Date: Thu, 19 Jan 2017 01:28:16 +0000 (-0800) Subject: Thaw filesystems if the snapshot commit message to VMX fails X-Git-Tag: stable-10.1.5~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b443e6456ffda66c0279032ab932ef271f8e1ae6;p=thirdparty%2Fopen-vm-tools.git Thaw filesystems if the snapshot commit message to VMX fails --- diff --git a/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c b/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c index 19afb3551..2c5c4fb53 100644 --- a/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c +++ b/open-vm-tools/services/plugins/vmbackup/syncDriverOps.c @@ -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;