The Samba-Bugzilla – Attachment 6067 Details for
Bug 7478
nanosleep used unconditionally in .../source3/modules/vfs_scannedonly.c
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
remove nanosleep and improve the whole wait loop behavior
0003-improve-the-wait-loop-when-reading-a-directory-that.patch (text/plain), 4.38 KB, created by
Olivier Sessink
on 2010-11-13 09:34:33 UTC
(
hide
)
Description:
remove nanosleep and improve the whole wait loop behavior
Filename:
MIME Type:
Creator:
Olivier Sessink
Created:
2010-11-13 09:34:33 UTC
Size:
4.38 KB
patch
obsolete
>From 97c23835d5df583432c9959e47d6e2008c934baa Mon Sep 17 00:00:00 2001 >From: olivier <olivier@virtscano.fakenet> >Date: Sat, 13 Nov 2010 16:17:55 +0100 >Subject: [PATCH] improved the wait loop when reading a directory with non-scanned-files > >--- > source3/modules/vfs_scannedonly.c | 25 ++++++++++--------------- > 1 files changed, 10 insertions(+), 15 deletions(-) > >diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c >index 1972735..fc855df 100644 >--- a/source3/modules/vfs_scannedonly.c >+++ b/source3/modules/vfs_scannedonly.c >@@ -86,7 +86,8 @@ struct Tscannedonly { > > struct scannedonly_DIR { > char *base; >- int notify_loop_done; >+ int recheck_tries_done; /* if 0 the directory listing has not yet >+ been checked for files that need to be scanned. */ > SMB_STRUCT_DIR *DIR; > }; > #define SCANNEDONLY_DEBUG 9 >@@ -438,8 +439,7 @@ static bool scannedonly_allow_access(vfs_handle_struct * handle, > > notify_scanner(handle, smb_fname->base_name); > >- didloop = 0; >- if (loop && sDIR && !sDIR->notify_loop_done) { >+ if (loop && sDIR && sDIR->recheck_tries_done == 0) { > /* check the rest of the directory and notify the > scanner if some file needs scanning */ > long offset; >@@ -464,35 +464,30 @@ static bool scannedonly_allow_access(vfs_handle_struct * handle, > talloc_free(smb_fname2); > dire = SMB_VFS_NEXT_READDIR(handle, sDIR->DIR,NULL); > } >- sDIR->notify_loop_done = 1; >- didloop = 1; >+ sDIR->recheck_tries_done = 1; > SMB_VFS_NEXT_SEEKDIR(handle, sDIR->DIR, offset); > } > if (recheck_time > 0 > && ((recheck_size > 0 > && smb_fname->st.st_ex_size < (1024 * recheck_size)) >- || didloop)) { >- int i = 0; >+ || (sDIR && sDIR->recheck_tries_done < recheck_tries))) { > flush_sendbuffer(handle); > while (retval != 0 /*&& errno == ENOENT */ >- && i < recheck_tries) { >- struct timespec req = { 0, recheck_time * 10000 }; >+ && sDIR->recheck_tries_done < recheck_tries) { > DEBUG(SCANNEDONLY_DEBUG, > ("scannedonly_allow_access, wait (try=%d " > "(max %d), %d ms) for %s\n", >- i, recheck_tries, >+ sDIR->recheck_tries_done, recheck_tries, > recheck_time, cache_smb_fname->base_name)); >- nanosleep(&req, NULL); >+ smb_msleep(recheck_time); > retval = SMB_VFS_NEXT_STAT(handle, cache_smb_fname); >- i++; >+ sDIR->recheck_tries_done++; > } > } > /* still no cachefile, or still too old, return 0 */ > if (retval != 0 > || !timespec_is_newer(&smb_fname->st.st_ex_ctime, > &cache_smb_fname->st.st_ex_ctime)) { >- DEBUG(SCANNEDONLY_DEBUG, >- ("retval=%d, return 0\n",retval)); > return false; > } > return true; >@@ -523,7 +518,7 @@ static SMB_STRUCT_DIR *scannedonly_opendir(vfs_handle_struct * handle, > DEBUG(SCANNEDONLY_DEBUG, > ("scannedonly_opendir, fname=%s, base=%s\n",fname,sDIR->base)); > sDIR->DIR = DIRp; >- sDIR->notify_loop_done = 0; >+ sDIR->recheck_tries_done = 0; > return (SMB_STRUCT_DIR *) sDIR; > } > >-- >1.5.6.5 > > >From ceb7ff37c600a5225f380ad62fd651dc7e33a409 Mon Sep 17 00:00:00 2001 >From: olivier <olivier@virtscano.fakenet> >Date: Sat, 13 Nov 2010 16:22:47 +0100 >Subject: [PATCH] improve the wait loop when reading a directory that has multiple non-scanned-files > >--- > source3/modules/vfs_scannedonly.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c >index fc855df..e999647 100644 >--- a/source3/modules/vfs_scannedonly.c >+++ b/source3/modules/vfs_scannedonly.c >@@ -471,18 +471,21 @@ static bool scannedonly_allow_access(vfs_handle_struct * handle, > && ((recheck_size > 0 > && smb_fname->st.st_ex_size < (1024 * recheck_size)) > || (sDIR && sDIR->recheck_tries_done < recheck_tries))) { >+ int numloops=sDIR?sDIR->recheck_tries_done:0; > flush_sendbuffer(handle); > while (retval != 0 /*&& errno == ENOENT */ > && sDIR->recheck_tries_done < recheck_tries) { > DEBUG(SCANNEDONLY_DEBUG, > ("scannedonly_allow_access, wait (try=%d " > "(max %d), %d ms) for %s\n", >- sDIR->recheck_tries_done, recheck_tries, >+ numloops, recheck_tries, > recheck_time, cache_smb_fname->base_name)); > smb_msleep(recheck_time); > retval = SMB_VFS_NEXT_STAT(handle, cache_smb_fname); >- sDIR->recheck_tries_done++; >+ numloops++; > } >+ if (sDIR) >+ sDIR->recheck_tries_done = numloops; > } > /* still no cachefile, or still too old, return 0 */ > if (retval != 0 >-- >1.5.6.5 >
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 7478
:
6029
|
6030
| 6067