summaryrefslogtreecommitdiff
path: root/source3/smbd/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/fileio.c')
-rw-r--r--source3/smbd/fileio.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 76189d114b..375bfbe7cf 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -834,15 +834,18 @@ ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason)
sync a file
********************************************************************/
-void sync_file(connection_struct *conn, files_struct *fsp)
+void sync_file(connection_struct *conn, files_struct *fsp, BOOL write_through)
{
- if(lp_strict_sync(SNUM(conn)) && fsp->fh->fd != -1) {
+ if (fsp->fh->fd == -1)
+ return;
+
+ if (lp_strict_sync(SNUM(conn)) &&
+ (lp_syncalways(SNUM(conn)) || write_through)) {
flush_write_cache(fsp, SYNC_FLUSH);
SMB_VFS_FSYNC(fsp,fsp->fh->fd);
}
}
-
/************************************************************
Perform a stat whether a valid fd or not.
************************************************************/