[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Tue Aug 23 10:22:02 MDT 2011


The branch, master has been updated
       via  932f222 s/event_context/tevent_context/ in smbsock_any_connect
       via  5ba5ccd s/event_context/tevent_context/ in smbsock_connect
       via  89b672f scannedonly module: improve sleep behavior when reading a directory with multiple non-scanned files
      from  5007ad3 s3: Slightly simplify serverid_exists

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 932f2229f1337f3d5946103f5bd81e858ab4e805
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 23 16:50:32 2011 +0200

    s/event_context/tevent_context/ in smbsock_any_connect
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Tue Aug 23 18:21:58 CEST 2011 on sn-devel-104

commit 5ba5ccdc412bd3def2c9d8d62ac099a7f23c52d7
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 23 16:50:19 2011 +0200

    s/event_context/tevent_context/ in smbsock_connect

commit 89b672f24797f7ecc2ac5191a33a1ae5a38e07cc
Author: Olivier Sessink <oliviersessink at gmail.com>
Date:   Tue Aug 9 09:56:38 2011 +0200

    scannedonly module: improve sleep behavior when reading a directory with multiple non-scanned files

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/smbsock_connect.c  |    8 ++++----
 source3/modules/vfs_scannedonly.c |   30 ++++++++++++++++--------------
 2 files changed, 20 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/smbsock_connect.c b/source3/libsmb/smbsock_connect.c
index 3a228b1..3b6ccb4 100644
--- a/source3/libsmb/smbsock_connect.c
+++ b/source3/libsmb/smbsock_connect.c
@@ -373,11 +373,11 @@ NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
 			 int *pfd, uint16_t *ret_port, int sec_timeout)
 {
 	TALLOC_CTX *frame = talloc_stackframe();
-	struct event_context *ev;
+	struct tevent_context *ev;
 	struct tevent_req *req;
 	NTSTATUS status = NT_STATUS_NO_MEMORY;
 
-	ev = event_context_init(frame);
+	ev = tevent_context_init(frame);
 	if (ev == NULL) {
 		goto fail;
 	}
@@ -622,11 +622,11 @@ NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
 			     uint16_t *chosen_port)
 {
 	TALLOC_CTX *frame = talloc_stackframe();
-	struct event_context *ev;
+	struct tevent_context *ev;
 	struct tevent_req *req;
 	NTSTATUS status = NT_STATUS_NO_MEMORY;
 
-	ev = event_context_init(frame);
+	ev = tevent_context_init(frame);
 	if (ev == NULL) {
 		goto fail;
 	}
diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c
index 6d748c4..c1821bd 100644
--- a/source3/modules/vfs_scannedonly.c
+++ b/source3/modules/vfs_scannedonly.c
@@ -1,7 +1,7 @@
 /*
- * scannedonly VFS module for Samba 3.5
+ * scannedonly VFS module for Samba 3.5 and beyond
  *
- * Copyright 2007,2008,2009,2010 (C) Olivier Sessink
+ * Copyright 2007,2008,2009,2010,2011 (C) Olivier Sessink
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -88,7 +88,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
@@ -441,8 +442,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;
@@ -467,27 +467,29 @@ 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)
+		)) {
+		int numloops = sDIR ? sDIR->recheck_tries_done : 0;
 		flush_sendbuffer(handle);
 		while (retval != 0	/*&& errno == ENOENT */
-		       && i < recheck_tries) {
+		       && numloops < recheck_tries) {
 			DEBUG(SCANNEDONLY_DEBUG,
 			      ("scannedonly_allow_access, wait (try=%d "
 			       "(max %d), %d ms) for %s\n",
-			       i, 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);
-			i++;
+			numloops++;
 		}
+		if (sDIR)
+			sDIR->recheck_tries_done = numloops;
 	}
 	/* still no cachefile, or still too old, return 0 */
 	if (retval != 0
@@ -525,7 +527,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;
 }
 
@@ -553,7 +555,7 @@ static SMB_STRUCT_DIR *scannedonly_fdopendir(vfs_handle_struct * handle,
 	DEBUG(SCANNEDONLY_DEBUG,
 			("scannedonly_fdopendir, 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;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list