[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Jul 13 10:32:44 MDT 2010


The branch, master has been updated
       via  5bdb8b4... Revert "Remove the global char *LastDir."
      from  53e1586... s3-waf: fix the build.

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


- Log -----------------------------------------------------------------
commit 5bdb8b472ce9c8072d4ffade4075f9ec17ae3819
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 13 09:30:35 2010 -0700

    Revert "Remove the global char *LastDir."
    
    Volker pointed out I'd missed the "last directory" cache
    part of this code. Return us to caching the directory we're
    in (reduces sys call load).
    
    Mea maxima culpa.
    
    Jeremy.
    
    This reverts commit 2f30aea3324f32f9b8555e961256fc1280da2871.

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

Summary of changes:
 source3/smbd/globals.c |    1 +
 source3/smbd/globals.h |    1 +
 source3/smbd/vfs.c     |   21 ++++++++++++++++++++-
 3 files changed, 22 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 5df835d..324d13a 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -105,6 +105,7 @@ int conn_ctx_stack_ndx = 0;
 
 struct vfs_init_function_entry *backends = NULL;
 char *sparse_buf = NULL;
+char *LastDir = NULL;
 
 /* Current number of oplocks we have outstanding. */
 int32_t exclusive_oplocks_open = 0;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 9d9688f..c618efa 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -115,6 +115,7 @@ extern int conn_ctx_stack_ndx;
 struct vfs_init_function_entry;
 extern struct vfs_init_function_entry *backends;
 extern char *sparse_buf;
+extern char *LastDir;
 
 /* Current number of oplocks we have outstanding. */
 extern int32_t exclusive_oplocks_open;
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 7df51cf..d4e9f02 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -707,7 +707,26 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
 
 int vfs_ChDir(connection_struct *conn, const char *path)
 {
-	return SMB_VFS_CHDIR(conn,path);
+	int res;
+
+	if (!LastDir) {
+		LastDir = SMB_STRDUP("");
+	}
+
+	if (strcsequal(path,"."))
+		return(0);
+
+	if (*path == '/' && strcsequal(LastDir,path))
+		return(0);
+
+	DEBUG(4,("vfs_ChDir to %s\n",path));
+
+	res = SMB_VFS_CHDIR(conn,path);
+	if (!res) {
+		SAFE_FREE(LastDir);
+		LastDir = SMB_STRDUP(path);
+	}
+	return(res);
 }
 
 /*******************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list