mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
#ifdefed DMF fix so not compiled by default. We need to look at this...
Jeremy. (This used to be commit 97dca242a91c68048e510f42be53421b533183be)
This commit is contained in:
parent
86dee43f39
commit
391a72a95f
@ -91,34 +91,51 @@ read from a file
|
|||||||
|
|
||||||
ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
|
ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n)
|
||||||
{
|
{
|
||||||
ssize_t ret=0,readret;
|
ssize_t ret=0,readret;
|
||||||
|
|
||||||
/* you can't read from print files */
|
/* you can't read from print files */
|
||||||
if (fsp->print_file) {
|
if (fsp->print_file)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Serve from write cache if we can.
|
* Serve from write cache if we can.
|
||||||
*/
|
*/
|
||||||
if(read_from_write_cache(fsp, data, pos, n))
|
|
||||||
return n;
|
|
||||||
|
|
||||||
flush_write_cache(fsp, READ_FLUSH);
|
if(read_from_write_cache(fsp, data, pos, n))
|
||||||
|
return n;
|
||||||
|
|
||||||
if (seek_file(fsp,pos) == -1) {
|
flush_write_cache(fsp, READ_FLUSH);
|
||||||
DEBUG(3,("read_file: Failed to seek to %.0f\n",(double)pos));
|
|
||||||
return(ret);
|
if (seek_file(fsp,pos) == -1) {
|
||||||
}
|
DEBUG(3,("read_file: Failed to seek to %.0f\n",(double)pos));
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
readret = fsp->conn->vfs_ops.read(fsp,fsp->fd,data,n);
|
#ifdef DMF_FIX
|
||||||
if (readret == -1)
|
int numretries = 3;
|
||||||
return -1;
|
tryagain:
|
||||||
if (readret > 0) ret += readret;
|
readret = fsp->conn->vfs_ops.read(fsp,fsp->fd,data,n);
|
||||||
}
|
if (readret == -1) {
|
||||||
|
if ((errno == EAGAIN) && numretries) {
|
||||||
|
DEBUG(3,("read_file EAGAIN retry in 10 seconds\n"));
|
||||||
|
(void)sleep(10);
|
||||||
|
--numretries;
|
||||||
|
goto tryagain;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else /* NO DMF fix. */
|
||||||
|
readret = fsp->conn->vfs_ops.read(fsp,fsp->fd,data,n);
|
||||||
|
if (readret == -1)
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
return(ret);
|
if (readret > 0)
|
||||||
|
ret += readret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* how many write cache buffers have been allocated */
|
/* how many write cache buffers have been allocated */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user