1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

Fix for misunderstanding of fsync added when vfs layer

was done. Samba was doing fsync's (bleagh).
Jeremy.
This commit is contained in:
Herb Lewis 0001-01-01 00:00:00 +00:00
parent f2a5ba3f09
commit f9a52cadbf
4 changed files with 10 additions and 10 deletions

View 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 */

View 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);

View 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);
}
}
}

View 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)
{