Fix for misunderstanding of fsync added when vfs layer
authorHerb Lewis <herb@samba.org>
Wed, 10 May 2000 01:31:46 +0000 (01:31 +0000)
committerHerb Lewis <herb@samba.org>
Wed, 10 May 2000 01:31:46 +0000 (01:31 +0000)
was done. Samba was doing fsync's (bleagh).
Jeremy.

source/include/proto.h
source/smbd/fileio.c
source/smbd/files.c
source/smbd/reply.c

index 4941dd85198e7e018fcdb65aa6fc0d9047b1e47e..ec786985d38fa3cc9f996632c661d1a257dedb7f 100644 (file)
@@ -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  */
 
index 6507f5660626d5f80a08e4d490bfc9c3e3468e3a..79dcd8ab83fda04460150c1788ee3ace52d0b5c2 100644 (file)
@@ -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);
index 5b930f994009759489cc8e76f1cd657617871b78..a4837a1a8bc9b0d6704e79b4d4d604d0b9892e68 100644 (file)
@@ -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);
                }
        }
 }
index b09e09bc6def9cf1c91c43fb25e616b695a43234..20726671744bdadd8d559e70469f1ef915e7f25a 100644 (file)
@@ -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)
   {