summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-09-06 01:37:14 +0000
committerAndrew Tridgell <tridge@samba.org>1998-09-06 01:37:14 +0000
commitc83f3775cd8a7aad13571926cdd5949a07538771 (patch)
treee10558db5f32000410811da8ad5bfde80c2d39d9
parentc96b5fde5ae12bd0d4d6bcff095cf090738c92a4 (diff)
downloadsamba-c83f3775cd8a7aad13571926cdd5949a07538771.tar.gz
add a "stat cache" boolean smb.conf option. (defaults to on)
I think we need this so we can rule out stat cache bugs when dealing with bug reports. If we ask a user to disable the stat cache and the problem persists then we know it isn't a stat cache bug. The stat cache code is sufficiently complicated that it can be pretty hard to tell if it is causing problems or not.
-rw-r--r--source/include/proto.h1
-rw-r--r--source/param/loadparm.c4
-rw-r--r--source/smbd/filename.c12
3 files changed, 15 insertions, 2 deletions
diff --git a/source/include/proto.h b/source/include/proto.h
index 7430affd346..a7581ced79a 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -926,6 +926,7 @@ BOOL lp_unix_password_sync(void);
BOOL lp_passwd_chat_debug(void);
BOOL lp_ole_locking_compat(void);
BOOL lp_nt_smb_support(void);
+BOOL lp_stat_cache(void);
int lp_os_level(void);
int lp_max_ttl(void);
int lp_max_wins_ttl(void);
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 8e759cbbb0a..fe3cf2f06af 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -228,6 +228,7 @@ typedef struct
BOOL bOleLockingCompat;
BOOL bTimestampLogs;
BOOL bNTSmbSupport;
+ BOOL bStatCache;
} global;
static global Globals;
@@ -643,6 +644,7 @@ static struct parm_struct parm_table[] =
{"map archive", P_BOOL, P_LOCAL, &sDefault.bMap_archive, NULL, NULL, FLAG_GLOBAL},
{"mangled names", P_BOOL, P_LOCAL, &sDefault.bMangledNames, NULL, NULL, FLAG_GLOBAL},
{"mangled map", P_STRING, P_LOCAL, &sDefault.szMangledMap, NULL, NULL, FLAG_GLOBAL},
+ {"stat cache", P_BOOL, P_GLOBAL, &Globals.bStatCache, NULL, NULL, 0},
{"Domain Options", P_SEP, P_SEPARATOR},
{"domain sid", P_USTRING, P_GLOBAL, &Globals.szDomainSID, NULL, NULL, 0},
@@ -850,6 +852,7 @@ static void init_globals(void)
Globals.bPasswdChatDebug = False;
Globals.bOleLockingCompat = True;
Globals.bNTSmbSupport = True; /* Do NT SMB's by default. */
+ Globals.bStatCache = True; /* use stat cache by default */
#ifdef WITH_LDAP
/* default values for ldap */
@@ -1135,6 +1138,7 @@ FN_GLOBAL_BOOL(lp_unix_password_sync,&Globals.bUnixPasswdSync)
FN_GLOBAL_BOOL(lp_passwd_chat_debug,&Globals.bPasswdChatDebug)
FN_GLOBAL_BOOL(lp_ole_locking_compat,&Globals.bOleLockingCompat)
FN_GLOBAL_BOOL(lp_nt_smb_support,&Globals.bNTSmbSupport)
+FN_GLOBAL_BOOL(lp_stat_cache,&Globals.bStatCache)
FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index ee9ce3f8350..a88829de9d6 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -150,7 +150,11 @@ static void stat_cache_add( char *full_orig_name, char *orig_translated_path)
stat_cache_entry *scp;
pstring orig_name;
pstring translated_path;
- int namelen = strlen(orig_translated_path);
+ int namelen;
+
+ if (!lp_stat_cache()) return;
+
+ namelen = strlen(orig_translated_path);
/*
* Don't cache trivial valid directory entries.
@@ -235,8 +239,12 @@ static BOOL stat_cache_lookup( char *name, char *dirpath, char **start, SMB_STRU
{
stat_cache_entry *scp;
stat_cache_entry *longest_hit = NULL;
- int namelen = strlen(name);
+ int namelen;
+
+ if (!lp_stat_cache()) return False;
+ namelen = strlen(name);
+
*start = name;
global_stat_cache_lookups++;