The Samba-Bugzilla – Attachment 545 Details for
Bug 1469
lacking the last part of a file, writing to a NFS file sytem.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
for samba-2.2.9
nfs-229.patch (text/plain), 6.98 KB, created by
YABUUCHI Kenji
on 2004-06-20 23:27:00 UTC
(
hide
)
Description:
for samba-2.2.9
Filename:
MIME Type:
Creator:
YABUUCHI Kenji
Created:
2004-06-20 23:27:00 UTC
Size:
6.98 KB
patch
obsolete
>--- include/proto.h.orig Wed Jun 16 16:53:44 2004 >+++ include/proto.h Wed Jun 16 17:04:37 2004 >@@ -4445,7 +4445,7 @@ > void delete_write_cache __P((files_struct *fsp)); > void set_filelen_write_cache __P((files_struct *fsp, SMB_OFF_T file_size)); > ssize_t flush_write_cache __P((files_struct *fsp, enum flush_reason_enum reason)); >-void sync_file __P((connection_struct *conn, files_struct *fsp)); >+int sync_file __P((connection_struct *conn, files_struct *fsp)); > int fsp_stat __P((files_struct *fsp, SMB_STRUCT_STAT *pst)); > > /* The following definitions come from smbd/filename.c */ >--- smbd/files.c.orig Thu Nov 21 21:59:47 2002 >+++ smbd/files.c Wed Jun 16 17:04:37 2004 >@@ -324,7 +324,7 @@ > for (fsp=Files;fsp;fsp=next) { > next=fsp->next; > if ((conn == fsp->conn) && (fsp->fd != -1)) { >- sync_file(conn,fsp); >+ (void)sync_file(conn,fsp); > } > } > } >--- smbd/fileio.c.orig Wed Feb 5 15:15:15 2003 >+++ smbd/fileio.c Wed Jun 16 17:04:37 2004 >@@ -749,12 +749,15 @@ > sync a file > ********************************************************************/ > >-void sync_file(connection_struct *conn, files_struct *fsp) >+int sync_file(connection_struct *conn, files_struct *fsp) > { >+ int ret = 0; >+ > if(lp_strict_sync(SNUM(conn)) && fsp->fd != -1) { > flush_write_cache(fsp, SYNC_FLUSH); >- conn->vfs_ops.fsync(fsp,fsp->fd); >+ ret = conn->vfs_ops.fsync(fsp,fsp->fd); > } >+ return ret; > } > >--- smbd/reply.c.orig Thu Jul 17 19:41:37 2003 >+++ smbd/reply.c Wed Jun 16 18:00:21 2004 >@@ -2760,6 +2760,7 @@ > BOOL write_through; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); > int outsize = 0; >+ int syncerr = 0; > START_PROFILE(SMBwritebraw); > > CHECK_FSP(fsp,conn); >@@ -2791,11 +2792,13 @@ > > if (numtowrite>0) > nwritten = write_file(fsp,data,startpos,numtowrite); >+ if ((lp_syncalways(SNUM(conn)) || write_through) && lp_strict_sync(SNUM(conn))) >+ syncerr = sync_file(conn,fsp); > > DEBUG(3,("writebraw1 fnum=%d start=%.0f num=%d wrote=%d sync=%d\n", > fsp->fnum, (double)startpos, (int)numtowrite, (int)nwritten, (int)write_through)); > >- if (nwritten < (ssize_t)numtowrite) { >+ if (nwritten < (ssize_t)numtowrite || syncerr != 0) { > END_PROFILE(SMBwritebraw); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } >@@ -2842,8 +2845,11 @@ > } > > nwritten = write_file(fsp,inbuf+4,startpos+nwritten,numtowrite); >+ if ((lp_syncalways(SNUM(conn)) || write_through) && lp_strict_sync(SNUM(conn))) >+ syncerr = sync_file(conn,fsp); >+ > >- if (nwritten < (ssize_t)numtowrite) { >+ if (nwritten < (ssize_t)numtowrite || syncerr != 0) { > SCVAL(outbuf,smb_rcls,ERRHRD); > SSVAL(outbuf,smb_err,ERRdiskfull); > } >@@ -2853,7 +2859,7 @@ > } > > if ((lp_syncalways(SNUM(conn)) || write_through) && lp_strict_sync(SNUM(conn))) >- sync_file(conn,fsp); >+ (void)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)); >@@ -2886,6 +2892,7 @@ > NTSTATUS status; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); > int outsize = 0; >+ int syncerr = 0; > START_PROFILE(SMBwriteunlock); > > CHECK_FSP(fsp,conn); >@@ -2910,9 +2917,9 @@ > nwritten = write_file(fsp,data,startpos,numtowrite); > > if (lp_syncalways(SNUM(conn))) >- sync_file(conn,fsp); >+ syncerr = sync_file(conn,fsp); > >- if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) { >+ if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0) || syncerr != 0) { > END_PROFILE(SMBwriteunlock); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } >@@ -2947,6 +2954,7 @@ > char *data; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); > int outsize = 0; >+ int syncerr = 0; > START_PROFILE(SMBwrite); > > /* If it's an IPC, pass off the pipe handler. */ >@@ -2991,9 +2999,9 @@ > nwritten = write_file(fsp,data,startpos,numtowrite); > > if (lp_syncalways(SNUM(conn))) >- sync_file(conn,fsp); >+ syncerr = sync_file(conn,fsp); > >- if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) { >+ if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0) || syncerr != 0) { > END_PROFILE(SMBwrite); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } >@@ -3028,6 +3036,7 @@ > unsigned int smblen = smb_len(inbuf); > char *data; > BOOL large_writeX = ((CVAL(inbuf,smb_wct) == 14) && (smblen > 0xFFFF)); >+ int syncerr = 0; > START_PROFILE(SMBwriteX); > > /* If it's an IPC, pass off the pipe handler. */ >@@ -3087,7 +3096,10 @@ > else > nwritten = write_file(fsp,data,startpos,numtowrite); > >- if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) { >+ if (lp_syncalways(SNUM(conn)) || write_through) >+ syncerr = sync_file(conn,fsp); >+ >+ if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0) || syncerr != 0) { > END_PROFILE(SMBwriteX); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } >@@ -3107,7 +3119,7 @@ > fsp->fnum, (int)numtowrite, (int)nwritten)); > > if (lp_syncalways(SNUM(conn)) || write_through) >- sync_file(conn,fsp); >+ (void)sync_file(conn,fsp); > > END_PROFILE(SMBwriteX); > return chain_reply(inbuf,outbuf,length,bufsize); >@@ -3211,7 +3223,7 @@ > if (!fsp) { > file_sync_all(conn); > } else { >- sync_file(conn,fsp); >+ (void)sync_file(conn,fsp); > } > > DEBUG(3,("flush\n")); >@@ -3667,6 +3679,9 @@ > int outsize = set_message(outbuf,0,0,True); > char *data; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); >+ BOOL write_through = BITSETW(inbuf+smb_vwv7,0); >+ int nwritten; >+ int syncerr; > START_PROFILE(SMBsplwr); > > if (!CAN_PRINT(conn)) { >@@ -3680,8 +3695,12 @@ > numtowrite = SVAL(smb_buf(inbuf),1); > data = smb_buf(inbuf) + 3; > >- if (write_file(fsp,data,-1,numtowrite) != numtowrite) { >- END_PROFILE(SMBsplwr); >+ nwritten = write_file(fsp,data,-1,numtowrite); >+ if ((lp_syncalways(SNUM(conn)) || write_through) && lp_strict_sync(SNUM(conn))) >+ syncerr = sync_file(conn,fsp); >+ >+ if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0) || syncerr != 0) { >+ END_PROFILE(SMBwriteX); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } > >@@ -5063,6 +5082,7 @@ > int smb_doff; > char *data; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); >+ int syncerr = 0; > START_PROFILE(SMBwriteBmpx); > > CHECK_FSP(fsp,conn); >@@ -5089,9 +5109,9 @@ > nwritten = write_file(fsp,data,startpos,numtowrite); > > if(lp_syncalways(SNUM(conn)) || write_through) >- sync_file(conn,fsp); >+ syncerr = sync_file(conn,fsp); > >- if(nwritten < (ssize_t)numtowrite) { >+ if(nwritten < (ssize_t)numtowrite || syncerr != 0) { > END_PROFILE(SMBwriteBmpx); > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } >@@ -5165,6 +5185,7 @@ > write_bmpx_struct *wbms; > BOOL send_response = False; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); >+ int syncerr = 0; > START_PROFILE(SMBwriteBs); > > CHECK_FSP(fsp,conn); >@@ -5200,9 +5221,9 @@ > nwritten = write_file(fsp,data,startpos,numtowrite); > > if(lp_syncalways(SNUM(conn)) || write_through) >- sync_file(conn,fsp); >+ syncerr = sync_file(conn,fsp); > >- if (nwritten < (ssize_t)numtowrite) { >+ if (nwritten < (ssize_t)numtowrite || syncerr != 0) { > if(write_through) { > /* We are returning an error - we can delete the aux struct */ > SAFE_FREE(wbms); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1469
:
544
| 545