tdbs in cache_dir or state_dir
Christof Schmitt
cs at samba.org
Thu Aug 18 21:04:48 UTC 2016
On Thu, Aug 18, 2016 at 02:07:14PM +0200, Stefan Metzmacher wrote:
> Hi Christof,
>
> basically lock_path() is for CLEAR_IF_FIRST files,
>
> cache_path() is on persistent storage but can safely deleted
> by the admin. And state_path() is for real persistent data.
>
> winbindd_cache.tdb is only in state_path() because of the
> "winbind offline logon" option. otherwise is could be
> in lock_path() as it's CLEAR_IF_FIRST.
>
> metze
Thanks you. I think that should be added to the documentation, see the
attached patches to clarify the entries in the smb.conf manpage and
adding a comment in the code.
Christof
-------------- next part --------------
From 960a96c33dc68b2a7232621c1acde798427e3225 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Thu, 18 Aug 2016 13:46:52 -0700
Subject: [PATCH 1/2] docs: Clarify description for cache, lock and state
directory settings
Signed-off-by: Christof Schmitt <cs at samba.org>
---
docs-xml/smbdotconf/misc/cachedirectory.xml | 7 +++++--
docs-xml/smbdotconf/misc/lockdirectory.xml | 4 ++++
docs-xml/smbdotconf/misc/statedirectory.xml | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/docs-xml/smbdotconf/misc/cachedirectory.xml b/docs-xml/smbdotconf/misc/cachedirectory.xml
index 6ffda0b..21d7d94 100644
--- a/docs-xml/smbdotconf/misc/cachedirectory.xml
+++ b/docs-xml/smbdotconf/misc/cachedirectory.xml
@@ -12,8 +12,11 @@
<parameter moreinfo="none">cache directory</parameter> options.
</para>
- <para> This option specifies the directory where TDB files containing
- non-persistent data will be stored.
+ <para>This option specifies the directory for storing TDB
+ files containing non-persistent data that will be kept across
+ service restarts. The directory should be placed on persistent
+ storage, but the data can be safely deleted by an
+ administrator.
</para>
</description>
diff --git a/docs-xml/smbdotconf/misc/lockdirectory.xml b/docs-xml/smbdotconf/misc/lockdirectory.xml
index 738de2e..3e58052 100644
--- a/docs-xml/smbdotconf/misc/lockdirectory.xml
+++ b/docs-xml/smbdotconf/misc/lockdirectory.xml
@@ -14,6 +14,10 @@
Note: This option can not be set inside registry
configurations.
</para>
+ <para>The files placed in this directory are not required
+ across service restarts and can be safely placed in volatile
+ storage (e.g. tmpfs in Linux)</para>
+
</description>
<value type="default">&pathconfig.LOCKDIR;</value>
diff --git a/docs-xml/smbdotconf/misc/statedirectory.xml b/docs-xml/smbdotconf/misc/statedirectory.xml
index 084f145..2f2b064 100644
--- a/docs-xml/smbdotconf/misc/statedirectory.xml
+++ b/docs-xml/smbdotconf/misc/statedirectory.xml
@@ -13,7 +13,7 @@
</para>
<para> This option specifies the directory where TDB files containing
- persistent data will be stored.
+ important persistent data will be stored.
</para>
</description>
--
1.8.3.1
From 0e3ebfdd2b63c2582e69c19251d5bab4cb8e5f00 Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Thu, 18 Aug 2016 14:01:50 -0700
Subject: [PATCH 2/2] winbindd: Introduce helper function for
winbindd_cache.tdb directory
Also add a comment why the file is placed in the state directory.
Signed-off-by: Christof Schmitt <cs at samba.org>
---
source3/winbindd/winbindd_cache.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index b2c0ae2..b921b75 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -111,6 +111,15 @@ void (*smb_panic_fn)(const char *const why) = smb_panic;
static struct winbind_cache *wcache;
+static char *wcache_path(void)
+{
+ /*
+ * Data needs to be kept persistent in state directory for
+ * running with "winbindd offline logon".
+ */
+ return state_path("winbindd_cache.tdb");
+}
+
/* get the winbind_cache structure */
static struct winbind_cache *get_cache(struct winbindd_domain *domain)
{
@@ -3195,7 +3204,7 @@ bool init_wcache(void)
if (wcache->tdb != NULL)
return true;
- db_path = state_path("winbindd_cache.tdb");
+ db_path = wcache_path();
if (db_path == NULL) {
return false;
}
@@ -3247,7 +3256,7 @@ bool initialize_winbindd_cache(void)
tdb_close(wcache->tdb);
wcache->tdb = NULL;
- db_path = state_path("winbindd_cache.tdb");
+ db_path = wcache_path();
if (db_path == NULL) {
return false;
}
@@ -3384,7 +3393,7 @@ void wcache_flush_cache(void)
return;
}
- db_path = state_path("winbindd_cache.tdb");
+ db_path = wcache_path();
if (db_path == NULL) {
return;
}
@@ -4281,7 +4290,7 @@ int winbindd_validate_cache(void)
DEBUG(10, ("winbindd_validate_cache: replacing panic function\n"));
smb_panic_fn = validate_panic;
- tdb_path = state_path("winbindd_cache.tdb");
+ tdb_path = wcache_path();
if (tdb_path == NULL) {
goto done;
}
@@ -4352,7 +4361,7 @@ int winbindd_validate_cache_nobackup(void)
DEBUG(10, ("winbindd_validate_cache: replacing panic function\n"));
smb_panic_fn = validate_panic;
- tdb_path = state_path("winbindd_cache.tdb");
+ tdb_path = wcache_path();
if (tdb_path == NULL) {
goto err_panic_restore;
}
--
1.8.3.1
More information about the samba-technical
mailing list