From c88222da0ced7edf90b68e68ec49e0fe35a512fe Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Wed, 10 May 2000 01:31:46 +0000 Subject: Fix for misunderstanding of fsync added when vfs layer was done. Samba was doing fsync's (bleagh). Jeremy. (This used to be commit f9a52cadbf11f7afcef754a59d783964a2edb5bc) --- source3/include/proto.h | 2 +- source3/smbd/fileio.c | 2 +- source3/smbd/files.c | 2 +- source3/smbd/reply.c | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 4941dd8519..ec786985d3 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3075,7 +3075,7 @@ ssize_t write_file(files_struct *fsp, char *data, SMB_OFF_T pos, size_t n); void delete_write_cache(files_struct *fsp); void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size); ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason); -void sys_fsync_file(connection_struct *conn, files_struct *fsp); +void sync_file(connection_struct *conn, files_struct *fsp); /*The following definitions come from smbd/filename.c */ diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 6507f56606..79dcd8ab83 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -650,7 +650,7 @@ ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason) sync a file ********************************************************************/ -void sys_fsync_file(connection_struct *conn, files_struct *fsp) +void sync_file(connection_struct *conn, files_struct *fsp) { if(lp_strict_sync(SNUM(conn)) && fsp->fd != -1) { flush_write_cache(fsp, SYNC_FLUSH); diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 5b930f9940..a4837a1a8b 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -283,7 +283,7 @@ void file_sync_all(connection_struct *conn) for (fsp=Files;fsp;fsp=next) { next=fsp->next; if ((conn == fsp->conn) && (fsp->fd != -1)) { - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); } } } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index b09e09bc6d..2072667174 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2352,7 +2352,7 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int size, if ((lp_syncalways(SNUM(conn)) || write_through) && lp_strict_sync(SNUM(conn))) - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); DEBUG(3,("writebraw2 fnum=%d start=%.0f num=%d wrote=%d\n", fsp->fnum, (double)startpos, (int)numtowrite,(int)total_written)); @@ -2400,7 +2400,7 @@ int reply_writeunlock(connection_struct *conn, char *inbuf,char *outbuf, int siz nwritten = write_file(fsp,data,startpos,numtowrite); if (lp_syncalways(SNUM(conn))) - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) return(UNIXERROR(ERRDOS,ERRnoaccess)); @@ -2455,7 +2455,7 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int size,int d nwritten = write_file(fsp,data,startpos,numtowrite); if (lp_syncalways(SNUM(conn))) - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) return(UNIXERROR(ERRDOS,ERRnoaccess)); @@ -2552,7 +2552,7 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng fsp->fnum, (int)numtowrite, (int)nwritten)); if (lp_syncalways(SNUM(conn)) || write_through) - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); return chain_reply(inbuf,outbuf,length,bufsize); } @@ -2649,7 +2649,7 @@ int reply_flush(connection_struct *conn, char *inbuf,char *outbuf, int size, int if (!fsp) { file_sync_all(conn); } else { - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); } DEBUG(3,("flush\n")); @@ -4246,7 +4246,7 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int size, nwritten = write_file(fsp,data,startpos,numtowrite); if(lp_syncalways(SNUM(conn)) || write_through) - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); if(nwritten < (ssize_t)numtowrite) return(UNIXERROR(ERRHRD,ERRdiskfull)); @@ -4347,7 +4347,7 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz nwritten = write_file(fsp,data,startpos,numtowrite); if(lp_syncalways(SNUM(conn)) || write_through) - conn->vfs_ops.fsync(fsp->fd); + sync_file(conn,fsp); if (nwritten < (ssize_t)numtowrite) { -- cgit