Rev 645: need sync on close too in http://samba.org/~tridge/3_0-ctdb

tridge at samba.org tridge at samba.org
Tue Oct 16 10:25:00 GMT 2007


------------------------------------------------------------
revno: 645
revision-id: tridge at samba.org-20071016102459-lha72gryd34a85yh
parent: tridge at samba.org-20071016101227-r5mhnl5622ujotd3
committer: Andrew Tridgell <tridge at samba.org>
branch nick: s3-ctdb-tridge
timestamp: Tue 2007-10-16 20:24:59 +1000
message:
  need sync on close too
modified:
  source/modules/vfs_syncops.c   vfs_syncops.c-20071016091912-7y95np83tib2zgxn-1
=== modified file 'source/modules/vfs_syncops.c'
--- a/source/modules/vfs_syncops.c	2007-10-16 09:46:43 +0000
+++ b/source/modules/vfs_syncops.c	2007-10-16 10:24:59 +0000
@@ -150,6 +150,17 @@
         SYNCOPS_NEXT(RMDIR, fname, (handle, fname));
 }
 
+/* close needs to be handled specially */
+static int syncops_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+{
+	if (fsp->can_write) {
+		/* ideally we'd only do this if we have written some
+		 data, but there is no flag for that in fsp yet. */
+		fsync(fd);
+	}
+	return SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+}
+
 
 /* VFS operations structure */
 
@@ -165,6 +176,7 @@
         {SMB_VFS_OP(syncops_symlink),    SMB_VFS_OP_SYMLINK,  SMB_VFS_LAYER_TRANSPARENT},
         {SMB_VFS_OP(syncops_link),       SMB_VFS_OP_LINK,     SMB_VFS_LAYER_TRANSPARENT},
         {SMB_VFS_OP(syncops_mknod),      SMB_VFS_OP_MKNOD,    SMB_VFS_LAYER_TRANSPARENT},
+	{SMB_VFS_OP(syncops_close), 	 SMB_VFS_OP_CLOSE,    SMB_VFS_LAYER_TRANSPARENT},
 
 	{SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
 };



More information about the samba-cvs mailing list