The Samba-Bugzilla – Attachment 544 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]
Check fsync() return value to indicate an error (samba-3.0.4)
nfs.patch (text/plain), 6.23 KB, created by
YABUUCHI Kenji
on 2004-06-20 23:03:54 UTC
(
hide
)
Description:
Check fsync() return value to indicate an error (samba-3.0.4)
Filename:
MIME Type:
Creator:
YABUUCHI Kenji
Created:
2004-06-20 23:03:54 UTC
Size:
6.23 KB
patch
obsolete
>--- include/proto.h 2004/06/16 03:18:56 1.1 >+++ include/proto.h 2004/06/16 03:19:01 >@@ -6147,7 +6147,7 @@ > 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 sync_file(connection_struct *conn, files_struct *fsp); >+int sync_file(connection_struct *conn, files_struct *fsp); > int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst); > > /* The following definitions come from smbd/filename.c */ >--- smbd/fileio.c 2004/06/16 01:47:52 1.1 >+++ smbd/fileio.c 2004/06/16 01:50:03 >@@ -757,12 +757,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); >- SMB_VFS_FSYNC(fsp,fsp->fd); >+ ret = SMB_VFS_FSYNC(fsp,fsp->fd); > } >+ return ret; > } > > >--- smbd/files.c 2004/06/16 03:09:14 1.1 >+++ smbd/files.c 2004/06/16 03:09:22 >@@ -359,7 +359,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/reply.c 2004/06/16 03:10:02 1.1 >+++ smbd/reply.c 2004/06/21 05:22:09 >@@ -2156,6 +2156,7 @@ > BOOL write_through; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); > int outsize = 0; >+ int syncerr = 0; > START_PROFILE(SMBwritebraw); > > if (srv_is_signing_active()) { >@@ -2191,11 +2192,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)); > } >@@ -2242,8 +2245,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); > } >@@ -2290,6 +2296,7 @@ > NTSTATUS status = NT_STATUS_OK; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); > int outsize = 0; >+ int syncerr = 0; > START_PROFILE(SMBwriteunlock); > > CHECK_FSP(fsp,conn); >@@ -2314,9 +2321,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)); > } >@@ -2353,6 +2360,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. */ >@@ -2397,9 +2405,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)); > } >@@ -2434,6 +2442,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. */ >@@ -2494,7 +2503,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)); > } >@@ -2514,7 +2526,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); >@@ -3093,6 +3105,8 @@ > 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 syncerr = 0; > > START_PROFILE(SMBsplwr); > >@@ -3112,6 +3126,12 @@ > return(UNIXERROR(ERRHRD,ERRdiskfull)); > } > >+ if ((lp_syncalways(SNUM(conn)) || write_through) && lp_strict_sync(SNUM(conn))) >+ syncerr = sync_file(conn,fsp); >+ if (syncerr != 0) { >+ END_PROFILE(SMBsplwr); >+ return(UNIXERROR(ERRHRD,ERRdiskfull)); >+ } > DEBUG( 3, ( "printwrite fnum=%d num=%d\n", fsp->fnum, numtowrite ) ); > > END_PROFILE(SMBsplwr); >@@ -4746,6 +4766,7 @@ > int smb_doff; > char *data; > files_struct *fsp = file_fsp(inbuf,smb_vwv0); >+ int syncerr = 0; > START_PROFILE(SMBwriteBmpx); > > CHECK_FSP(fsp,conn); >@@ -4772,9 +4793,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)); > } >@@ -4847,6 +4868,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); >@@ -4882,9 +4904,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 */ > if (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