From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:43 +0000 (-0700) Subject: Hgfs Server: Fix snapshot synchronization callback X-Git-Tag: stable-10.2.0~170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5f0d2872ff77a586a24a8959a74e85cbf30654e;p=thirdparty%2Fopen-vm-tools.git Hgfs Server: Fix snapshot synchronization callback Currently when snapshots occur, the VMX calls the HGFS server manager synchronization callback to notify the Hgfs server to freeze or thaw the Hgfs file IO activity. First, this Hgfs server synchronization callback is called regardless of the Hgfs Shared folders feature and server is enabled or not. Consequently, the Hgfs server callback lamely uses a global variable to track the server state just for this call and returns without doing anything if not initialized. Second, the HGFS server now requires the transport connection in order to extract the Hgfs session as the file notification component requires the session to allow its event generating thread to callback to the server to register and unregister through the transport which uses the PhysMem APIs. This change fixes: - call the Hgfs server only if Shared Folders and the server are enabled - call through the channel manager and channel transport to the Hgfs server - Hgfs server session callback table is extehded with a server quiesce callback. - HgfsServerSessionQuiesce callback now replaces the old HgfsServer_Quiesce exported API. - Make the quiesce callback use an enum to the thaw-freeze op instead of a bool - remove the Hgfs server initialized global now it is not required The tools implementation of the Hgfs server code does not use this API and thus the guest Hgfs manager and transport channel do not implement any code which will use the session quiesce callback. --- diff --git a/open-vm-tools/lib/include/hgfsServer.h b/open-vm-tools/lib/include/hgfsServer.h index 5fca45962..68f6c975b 100644 --- a/open-vm-tools/lib/include/hgfsServer.h +++ b/open-vm-tools/lib/include/hgfsServer.h @@ -161,6 +161,11 @@ typedef struct HgfsServerMgrCallbacks { HgfsServerResEnumCallbacks enumResources; } HgfsServerMgrCallbacks; +typedef enum { + HGFS_QUIESCE_FREEZE, + HGFS_QUIESCE_THAW, +} HgfsQuiesceOp; + /* * Function used for invalidating nodes and searches that fall outside of a * share when the list of shares changes. @@ -192,6 +197,7 @@ typedef struct HgfsServerSessionCallbacks { void (*invalidateObjects)(void *, DblLnkLst_Links *); uint32 (*invalidateInactiveSessions)(void *); void (*sendComplete)(HgfsPacket *, void *); + void (*quiesce)(void *, HgfsQuiesceOp); } HgfsServerSessionCallbacks; /* XXX: TODO delete this layer if no other non-session callbacks are required. */