Patch for HGFS stale caching issues (RHBZ#1342181).
This commit is contained in:
parent
8272aa13c2
commit
a5951a0af5
112
hgfs-cache.patch
Normal file
112
hgfs-cache.patch
Normal file
@ -0,0 +1,112 @@
|
||||
--- vmhgfs-fuse/main.c.orig 2016-09-13 17:42:20.000238000 -0700
|
||||
+++ vmhgfs-fuse/main.c 2016-09-13 17:51:04.001947000 -0700
|
||||
@@ -495,7 +495,9 @@
|
||||
}
|
||||
|
||||
res = HgfsDelete(abspath, HGFS_OP_DELETE_FILE);
|
||||
- HgfsInvalidateAttrCache(abspath);
|
||||
+ if (res == 0) {
|
||||
+ HgfsInvalidateAttrCache(abspath);
|
||||
+ }
|
||||
|
||||
exit:
|
||||
LOG(4, ("Exit(%d)\n", res));
|
||||
@@ -533,7 +535,9 @@
|
||||
}
|
||||
|
||||
res = HgfsDelete(abspath, HGFS_OP_DELETE_DIR);
|
||||
- HgfsInvalidateAttrCache(abspath);
|
||||
+ if (res == 0) {
|
||||
+ HgfsInvalidateAttrCache(abspath);
|
||||
+ }
|
||||
|
||||
exit:
|
||||
LOG(4, ("Exit(%d)\n", res));
|
||||
@@ -621,7 +625,10 @@
|
||||
}
|
||||
|
||||
res = HgfsRename(absfrom, absto);
|
||||
- HgfsInvalidateAttrCache(absfrom);
|
||||
+ if (res == 0) {
|
||||
+ HgfsInvalidateAttrCache(absfrom);
|
||||
+ HgfsInvalidateAttrCache(absto);
|
||||
+ }
|
||||
|
||||
exit:
|
||||
LOG(4, ("Exit(%d)\n", res));
|
||||
@@ -1136,7 +1143,14 @@
|
||||
}
|
||||
|
||||
res = HgfsWrite(fi, buf, size, offset);
|
||||
- HgfsInvalidateAttrCache(abspath);
|
||||
+ if (res >= 0) {
|
||||
+ /*
|
||||
+ * Positive result indicates the number of bytes written.
|
||||
+ * For zero bytes and no error, we still purge the cache
|
||||
+ * this could effect the attributes.
|
||||
+ */
|
||||
+ HgfsInvalidateAttrCache(abspath);
|
||||
+ }
|
||||
|
||||
exit:
|
||||
LOG(4, ("Exit(%d)\n", res));
|
||||
--- vmhgfs-fuse/cache.c.orig 2016-09-13 17:43:28.000010000 -0700
|
||||
+++ vmhgfs-fuse/cache.c 2016-09-13 17:45:56.000322000 -0700
|
||||
@@ -25,7 +25,13 @@
|
||||
#if !defined(__FreeBSD__) && !defined(__SOLARIS__)
|
||||
#include <glib.h>
|
||||
#endif
|
||||
-#define CACHE_TIMEOUT 5
|
||||
+
|
||||
+/*
|
||||
+ * We make the default attribute cache timeout 1 second which is the same
|
||||
+ * as the FUSE driver.
|
||||
+ * This can be overridden with the mount option attr_timeout=T
|
||||
+ */
|
||||
+#define CACHE_TIMEOUT HGFS_DEFAULT_TTL
|
||||
#define CACHE_PURGE_TIME 10
|
||||
#define CACHE_PURGE_SLEEP_TIME 30
|
||||
#define HASH_THRESHOLD_SIZE (2046 * 4)
|
||||
--- vmhgfs-fuse/module.h.orig 2016-09-13 17:49:17.000083000 -0700
|
||||
+++ vmhgfs-fuse/module.h 2016-09-13 17:49:44.000108000 -0700
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "vm_assert.h"
|
||||
#include "cpName.h"
|
||||
#include "cpNameLite.h"
|
||||
-#include "hgfsUtil.h"
|
||||
+#include "hgfsDevLinux.h"
|
||||
#include "request.h"
|
||||
#include "fsutil.h"
|
||||
#include "filesystem.h"
|
||||
--- vmhgfs-fuse/file.c.orig 2016-09-13 17:51:36.003169000 -0700
|
||||
+++ vmhgfs-fuse/file.c 2016-09-13 17:53:21.000104000 -0700
|
||||
@@ -859,6 +859,7 @@
|
||||
const char *buffer = buf;
|
||||
loff_t curOffset = offset;
|
||||
size_t nextCount, remainingCount = count;
|
||||
+ ssize_t bytesWritten = 0;
|
||||
|
||||
ASSERT(NULL != buf);
|
||||
ASSERT(NULL != fi);
|
||||
@@ -875,6 +876,7 @@
|
||||
|
||||
result = HgfsDoWrite(fi->fh, buffer, nextCount, curOffset);
|
||||
if (result < 0) {
|
||||
+ bytesWritten = result;
|
||||
LOG(4, ("Error: DoWrite -> %d\n", result));
|
||||
goto out;
|
||||
}
|
||||
@@ -884,9 +886,11 @@
|
||||
|
||||
} while ((result > 0) && (remainingCount > 0));
|
||||
|
||||
+ bytesWritten = count - remainingCount;
|
||||
+
|
||||
out:
|
||||
- LOG(6, ("Exit(0x%"FMTSZ"x)\n", count - remainingCount));
|
||||
- return (count - remainingCount);
|
||||
+ LOG(6, ("Exit(0x%"FMTSZ"x)\n", bytesWritten));
|
||||
+ return bytesWritten;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
Name: open-vm-tools
|
||||
Version: %{toolsversion}
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Open Virtual Machine Tools for virtual machines hosted on VMware
|
||||
Group: Applications/System
|
||||
License: GPLv2
|
||||
@ -44,6 +44,7 @@ ExclusiveArch: %{ix86} x86_64
|
||||
|
||||
Patch1: no-unused-const.patch
|
||||
Patch2: vmw-bitmask-gcc6.patch
|
||||
Patch3: hgfs-cache.patch
|
||||
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -126,6 +127,7 @@ VMware virtual machines.
|
||||
|
||||
%patch1 -p0
|
||||
%patch2 -p0
|
||||
%patch3 -p0
|
||||
|
||||
%build
|
||||
# Fedora 23 uses libsigc++-2.0 version 2.6.1.
|
||||
@ -297,6 +299,9 @@ fi
|
||||
%{_libdir}/libvmtools.so
|
||||
|
||||
%changelog
|
||||
* Wed Sep 14 2016 Ravindra Kumar <ravindrakumar@vmware.com> - 10.0.5-4
|
||||
- Patch for HGFS stale caching issues (RHBZ#1342181).
|
||||
|
||||
* Mon Jun 20 2016 Ravindra Kumar <ravindrakumar@vmware.com> - 10.0.5-3
|
||||
- Use systemd-detect-virt to detect VMware platform (RHBZ#1251656).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user