summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>1999-04-20 03:29:05 +0000
committerTim Potter <tpot@samba.org>1999-04-20 03:29:05 +0000
commit1e1a52bb5f0475327d435c06032d1e6234c28bcb (patch)
treeaf7572f8128b8a603620b0bbea7e4e889097f4f2 /source3/smbd
parent1fa178f6ce1aa64ec2b0324c9cd3cb877fc6d032 (diff)
downloadsamba-1e1a52bb5f0475327d435c06032d1e6234c28bcb.tar.gz
samba-1e1a52bb5f0475327d435c06032d1e6234c28bcb.tar.bz2
samba-1e1a52bb5f0475327d435c06032d1e6234c28bcb.zip
Changed arguments to fsync() function to break dependency on
connection_struct. (This used to be commit ee6f826ccc0897a4538f6f9a560127c54a4c4038)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/fileio.c5
-rw-r--r--source3/smbd/files.c5
-rw-r--r--source3/smbd/reply.c30
3 files changed, 22 insertions, 18 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 7ab13f33f4..1e16627515 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -128,10 +128,9 @@ ssize_t write_file(files_struct *fsp,char *data,size_t n)
sync a file
********************************************************************/
-void sys_sync_file(struct connection_struct *conn, files_struct *fsp)
+void sys_sync_file(int fd)
{
#ifdef HAVE_FSYNC
- if(lp_strict_sync(SNUM(conn)))
- fsync(fsp->fd_ptr->fd);
+ fsync(fd);
#endif
}
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 8aca336bf8..d366fa1e1a 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -340,8 +340,9 @@ void file_sync_all(connection_struct *conn)
for (fsp=Files;fsp;fsp=next) {
next=fsp->next;
- if (fsp->open && (conn == fsp->conn) && (fsp->fd_ptr != NULL)){
- conn->vfs_ops.sync(conn, fsp);
+ if (fsp->open && (conn == fsp->conn) && (fsp->fd_ptr != NULL)
+ && lp_strict_sync(SNUM(conn))){
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
}
}
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 51d737a784..b20236d6f4 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2200,8 +2200,9 @@ int reply_writebraw(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
SSVAL(outbuf,smb_err,ERRdiskfull);
}
- if (lp_syncalways(SNUM(conn)) || write_through)
- conn->vfs_ops.sync(conn, fsp);
+ if ((lp_syncalways(SNUM(conn)) || write_through) &&
+ lp_strict_sync(SNUM(conn)))
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
DEBUG(3,("writebraw2 fnum=%d start=%.0f num=%d wrote=%d\n",
fsp->fnum, (double)startpos, numtowrite, total_written));
@@ -2250,8 +2251,8 @@ int reply_writeunlock(connection_struct *conn, char *inbuf,char *outbuf, int dum
else
nwritten = write_file(fsp,data,numtowrite);
- if (lp_syncalways(SNUM(conn)))
- conn->vfs_ops.sync(conn, fsp);
+ if (lp_syncalways(SNUM(conn)) && lp_strict_sync(SNUM(conn)))
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0))
return(UNIXERROR(ERRDOS,ERRnoaccess));
@@ -2303,8 +2304,8 @@ int reply_write(connection_struct *conn, char *inbuf,char *outbuf,int dum_size,i
else
nwritten = write_file(fsp,data,numtowrite);
- if (lp_syncalways(SNUM(conn)))
- conn->vfs_ops.sync(conn, fsp);
+ if (lp_syncalways(SNUM(conn)) && lp_strict_sync(SNUM(conn)))
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0))
return(UNIXERROR(ERRDOS,ERRnoaccess));
@@ -2387,8 +2388,9 @@ int reply_write_and_X(connection_struct *conn, char *inbuf,char *outbuf,int leng
DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n",
fsp->fnum, numtowrite, nwritten));
- if (lp_syncalways(SNUM(conn)) || write_through)
- conn->vfs_ops.sync(conn, fsp);
+ if ((lp_syncalways(SNUM(conn)) || write_through) &&
+ lp_strict_sync(SNUM(conn)))
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
return chain_reply(inbuf,outbuf,length,bufsize);
}
@@ -2450,7 +2452,7 @@ int reply_flush(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
if (!fsp) {
file_sync_all(conn);
} else {
- conn->vfs_ops.sync(conn, fsp);
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
}
DEBUG(3,("flush\n"));
@@ -3931,8 +3933,9 @@ int reply_writebmpx(connection_struct *conn, char *inbuf,char *outbuf, int dum_s
nwritten = write_file(fsp,data,numtowrite);
- if(lp_syncalways(SNUM(conn)) || write_through)
- conn->vfs_ops.sync(conn, fsp);
+ if((lp_syncalways(SNUM(conn)) || write_through) &&
+ lp_strict_sync(SNUM(conn)))
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
if(nwritten < (ssize_t)numtowrite)
return(UNIXERROR(ERRHRD,ERRdiskfull));
@@ -4044,8 +4047,9 @@ int reply_writebs(connection_struct *conn, char *inbuf,char *outbuf, int dum_siz
nwritten = write_file(fsp,data,numtowrite);
- if(lp_syncalways(SNUM(conn)) || write_through)
- conn->vfs_ops.sync(conn, fsp);
+ if((lp_syncalways(SNUM(conn)) || write_through) &&
+ lp_strict_sync(SNUM(conn)))
+ conn->vfs_ops.sync(fsp->fd_ptr->fd);
if (nwritten < (ssize_t)numtowrite)
{