From: VMware, Inc <> Date: Fri, 18 Sep 2009 21:24:58 +0000 (-0700) Subject: Flush out stale file data before changing modification time X-Git-Tag: 2009.09.18-193784~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98d38b912cc8c60fccb3ad50e2a02ea505ace986;p=thirdparty%2Fopen-vm-tools.git Flush out stale file data before changing modification time This is to address bug 360310, where "cp -p" didn't preserve time and date. See bug 360310 for details. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/linux/vmhgfs/inode.c b/open-vm-tools/modules/linux/vmhgfs/inode.c index f41352795..377f1bacb 100644 --- a/open-vm-tools/modules/linux/vmhgfs/inode.c +++ b/open-vm-tools/modules/linux/vmhgfs/inode.c @@ -1967,9 +1967,9 @@ HgfsSetattr(struct dentry *dentry, // IN: File to set attributes of /* * Flush all dirty pages prior to sending the request if we're going to - * modify the file size. + * modify the file size or change the last write time. */ - if (iattr->ia_valid & ATTR_SIZE) { + if (iattr->ia_valid & ATTR_SIZE || iattr->ia_valid & ATTR_MTIME) { compat_filemap_write_and_wait(dentry->d_inode->i_mapping); }