Hi there Jain! No problem, I've sent in the agreement and I'm waiting on the approval. I've also got a small update on the VMHGFS memory leaks. I've written up a small patch files that work against the previous one. It just frees up all the resources allocated for the HgfsFile's along with the files themselves. Right now there appear to be no memory leaks left with no warning messages reported. I'm also checking out some interesting bugs which I haven't quite tracked down the cause of yet. Back to the memory leak patch, I'm looking for some request-for-comments as it's still a work in progress so I'm still doing a lot of tests to make sure it's all fine, but here's an overview of the changes/additions:
state.h - added two macros from state.c for code reuse as they're used in vfsops.c state.c - removed macros mentioned above vfsops.c - just a simple loop through the hash table with calls to HgfsReleaseVnodeContext() to free up resources Here's the patch, so until next time! --- open-vm-tools-2010.09.19-301124/modules/freebsd/vmhgfs/vfsops.c 2010-10-13 00:04:57.000000000 +0000 +++ open-vm-tools/modules/freebsd/vmhgfs/vfsops.c 2010-10-12 23:49:46.000000000 +0000 @@ -291,20 +291,24 @@ #endif { HgfsSuperInfo *sip; + HgfsFileHashTable *htp; int ret = 0; int flags = 0; + int i; sip = (HgfsSuperInfo *)mp->mnt_data; ASSERT(sip); + htp = &sip->fileHashTable; + /* * If there are pending requests & we're not being forced out, tell the user * that we're still busy. */ if (((mntflags & MNT_FORCE) == 0) && ((HgfsKReq_ContainerIsEmpty(sip->reqs) == FALSE) || - (HgfsFileHashTableIsEmpty(sip, &sip->fileHashTable) == FALSE))) { + (HgfsFileHashTableIsEmpty(sip, htp) == FALSE))) { return EBUSY; } @@ -325,10 +329,21 @@ return ret; } - /* Release the root file's data structures */ - HgfsReleaseVnodeContext(sip->rootVnode, &sip->fileHashTable); - - HgfsDestroyFileHashTable(&sip->fileHashTable); + /* + * Release all the data structures associate with the allocated files + * that have been placed into the hash table during the module's lifetime + */ + for (i = 0; i < ARRAYSIZE(htp->hashTable); i++) { + DblLnkLst_Links *currNode = HGFS_FILE_HT_HEAD(htp, i); + + while (currNode != HGFS_FILE_HT_BUCKET(htp, i)) { + HgfsFile *currFile = DblLnkLst_Container(currNode, HgfsFile, listNode); + currNode = currNode->next; + HgfsReleaseVnodeContext(currFile->vnodep, htp); + } + } + + HgfsDestroyFileHashTable(htp); /* * Now we can throw away our superinfo. Let's reclaim everything allocated --- open-vm-tools-2010.09.19-301124/modules/freebsd/vmhgfs/state.c 2010-10-13 00:04:57.000000000 +0000 +++ open-vm-tools/modules/freebsd/vmhgfs/state.c 2010-10-12 10:25:59.000000000 +0000 @@ -53,9 +53,6 @@ * Macros */ -#define HGFS_FILE_HT_HEAD(ht, index) (ht->hashTable[index]).next -#define HGFS_FILE_HT_BUCKET(ht, index) (&ht->hashTable[index]) - #define HGFS_IS_ROOT_FILE(sip, file) (HGFS_VP_TO_FP(sip->rootVnode) == file) #define LCK_MTX_ASSERT(mutex) --- open-vm-tools-2010.09.19-301124/modules/freebsd/vmhgfs/state.h 2010-09-20 18:30:55.000000000 +0000 +++ open-vm-tools/modules/freebsd/vmhgfs/state.h 2010-10-12 10:25:42.000000000 +0000 @@ -80,6 +80,8 @@ #define HGFS_VP_TO_FILESIZE(vp) \ HGFS_VP_TO_FP(vp)->fileSize +#define HGFS_FILE_HT_HEAD(ht, index) (ht->hashTable[index]).next +#define HGFS_FILE_HT_BUCKET(ht, index) (&ht->hashTable[index]) /* * Types ________________________________________ From: Shaileshkumar Jain [saj...@vmware.com] Sent: Saturday, October 09, 2010 6:16 AM To: open-vm-tools development Subject: RE: FreeBSD 8.1 VMHGFS patch Thanks Ivan for the patch! Before we can do anything could you follow this step ? http://open-vm-tools.sourceforge.net/contribute.php Shailesh Jain ________________________________________ ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ open-vm-tools-devel mailing list open-vm-tools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-vm-tools-devel