[SCM] SAMBA-CTDB repository - branch v3-4-ctdb updated - 3.4.7-ctdb-1-4-gf7bf72e
Michael Adam
obnox at samba.org
Tue Mar 23 01:17:00 MDT 2010
The branch, v3-4-ctdb has been updated
via f7bf72eac2918ab558211d76c491b8481925273f (commit)
via f02aa75bb61a946a4cb6220d29fa405846d07733 (commit)
via c4e49ef36a0bda8e594780232b408359b97c3c7b (commit)
via 789813dba2b4b50e3af5577128465964c1b0934e (commit)
from 3648046962a7cce0f9caeef6bd199ab1878bfdc1 (commit)
http://gitweb.samba.org/?p=obnox/samba-ctdb.git;a=shortlog;h=v3-4-ctdb
- Log -----------------------------------------------------------------
commit f7bf72eac2918ab558211d76c491b8481925273f
Author: Michael Adam <obnox at samba.org>
Date: Fri Feb 12 16:46:33 2010 +0100
s3:configure: prevent using external libtalloc with version >= 1.4.0
There was an ABI change and this results in an error
"undefined symbol: _talloc_free"
Michael
commit f02aa75bb61a946a4cb6220d29fa405846d07733
Author: Volker Lendecke <vl at samba.org>
Date: Fri Mar 5 16:46:36 2010 +0100
s3: Add the "ctdb locktime warn threshold" parameter
This is mainly a debugging aid for post-mortem analysis in case a cluster file
system is slow.
commit c4e49ef36a0bda8e594780232b408359b97c3c7b
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 22 11:19:10 2010 +0100
s3: Add "log writeable files on exit" parameter
This boolean option controls whether at exit time the server dumps a list of
files with debug level 0 that were still open for write. This is an
administrative aid to find the files that were potentially corrupt if the
network connection died.
commit 789813dba2b4b50e3af5577128465964c1b0934e
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 22 09:16:57 2010 +0100
s3: file_walk_table -> files_forall
This is more in line with the rest of the Samba code, like connections_forall
etc.
-----------------------------------------------------------------------
Summary of changes:
.../smbdotconf/misc/ctdblocktimewarnthreshold.xml | 16 ++++++++++
.../smbdotconf/misc/logwriteablefilesonexit.xml | 16 ++++++++++
source3/configure.in | 18 +++++++++++-
source3/include/proto.h | 4 ++-
source3/lib/dbwrap_ctdb.c | 12 +++++++
source3/modules/vfs_aio_fork.c | 2 +-
source3/param/loadparm.c | 25 ++++++++++++++++
source3/smbd/files.c | 2 +-
source3/smbd/server.c | 31 ++++++++++++++++++++
9 files changed, 122 insertions(+), 4 deletions(-)
create mode 100644 docs-xml/smbdotconf/misc/ctdblocktimewarnthreshold.xml
create mode 100644 docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml
Changeset truncated at 500 lines:
diff --git a/docs-xml/smbdotconf/misc/ctdblocktimewarnthreshold.xml b/docs-xml/smbdotconf/misc/ctdblocktimewarnthreshold.xml
new file mode 100644
index 0000000..149d8d6
--- /dev/null
+++ b/docs-xml/smbdotconf/misc/ctdblocktimewarnthreshold.xml
@@ -0,0 +1,16 @@
+<samba:parameter name="ctdb locktime warn threshold"
+ context="G"
+ type="integer"
+ advanced="1"
+ xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+ <para>In a cluster, ctdb is very unhappy if tdb database locks
+ are held for extended periods of time. This parameter adds a
+ warning threshold in milliseconds. If Samba holds a lock for
+ longer that ctdb locktime warn threshold milliseconds, a debug
+ level 0 message is printed when the lock is released. This is
+ mainly a debugging aid for post-mortem analysis.</para>
+ <para>If this parameter is set to 0, no message is printed.</para>
+</description>
+<value type="default">0</value>
+</samba:parameter>
diff --git a/docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml b/docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml
new file mode 100644
index 0000000..1c75457
--- /dev/null
+++ b/docs-xml/smbdotconf/misc/logwriteablefilesonexit.xml
@@ -0,0 +1,16 @@
+<samba:parameter name="log writeable files on exit"
+ context="G"
+ type="boolean"
+ advanced="1" developer="0"
+ xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+ <para>
+ This boolean option controls whether at exit time the server
+ dumps a list of files with debug level 0 that were still open
+ for write. This is an administrative aid to find the files
+ that were potentially corrupt if the network connection died.
+ </para>
+</description>
+
+<value type="default">no</value>
+</samba:parameter>
diff --git a/source3/configure.in b/source3/configure.in
index 9b1f3fa..d61fed8 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -30,13 +30,29 @@ AC_ARG_ENABLE(external_libtalloc, [AS_HELP_STRING([--enable-external-libtalloc],
if test "x$enable_external_libtalloc" != xno
then
PKG_CHECK_MODULES(TALLOC, talloc >= 1.3.0,
- [ enable_external_libtalloc=yes ],
+ [ found_external_libtalloc=yes ],
[ if test "x$enable_external_libtalloc" = xyes; then
AC_MSG_ERROR([Unable to find libtalloc])
else
enable_external_libtalloc=no
fi
])
+
+ TALLOC_LIBS=""
+ TALLOC_CFLAGS=""
+
+ if test "x$found_external_libtalloc" = "xyes"
+ then
+ PKG_CHECK_MODULES(TALLOC, talloc < 1.4.0,
+ [ enable_external_libtalloc=yes ],
+ [ if test "x$enable_external_libtalloc" = "xyes" ; then
+ AC_MSG_ERROR([Unable to find suitable
+ libtalloc])
+ else
+ enable_external_libtalloc=no
+ fi
+ ])
+ fi
fi
if test "x$enable_external_libtalloc" != xyes
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3dffeaf..8a8b272 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4013,6 +4013,7 @@ bool lp_usershare_allow_guests(void);
bool lp_usershare_owner_only(void);
bool lp_disable_netbios(void);
bool lp_reset_on_zero_vc(void);
+bool lp_log_writeable_files_on_exit(void);
bool lp_ms_add_printer_wizard(void);
bool lp_dns_proxy(void);
bool lp_wins_support(void);
@@ -4127,6 +4128,7 @@ const char *lp_ctdbd_socket(void);
const char **lp_cluster_addresses(void);
bool lp_clustering(void);
int lp_ctdb_timeout(void);
+int lp_ctdb_locktime_warn_threshold(void);
char *lp_printcommand(int );
char *lp_lpqcommand(int );
char *lp_lprmcommand(int );
@@ -6424,7 +6426,7 @@ void file_close_pid(uint16 smbpid, int vuid);
void file_init(void);
void file_close_user(int vuid);
void file_dump_open_table(void);
-struct files_struct *file_walk_table(
+struct files_struct *files_forall(
struct files_struct *(*fn)(struct files_struct *fsp,
void *private_data),
void *private_data);
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index ddc8868..329d63c 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -50,6 +50,7 @@ struct db_ctdb_ctx {
struct db_ctdb_rec {
struct db_ctdb_ctx *ctdb_ctx;
struct ctdb_ltdb_header header;
+ struct timeval lock_time;
};
static struct db_record *fetch_locked_internal(struct db_ctdb_ctx *ctx,
@@ -903,6 +904,7 @@ static int db_ctdb_record_destr(struct db_record* data)
{
struct db_ctdb_rec *crec = talloc_get_type_abort(
data->private_data, struct db_ctdb_rec);
+ int threshold;
DEBUG(10, (DEBUGLEVEL > 10
? "Unlocking db %u key %s\n"
@@ -916,6 +918,14 @@ static int db_ctdb_record_destr(struct db_record* data)
return -1;
}
+ threshold = lp_ctdb_locktime_warn_threshold();
+ if (threshold != 0) {
+ double timediff = timeval_elapsed(&crec->lock_time);
+ if ((timediff * 1000) > threshold) {
+ DEBUG(0, ("Held tdb lock %f seconds\n", timediff));
+ }
+ }
+
return 0;
}
@@ -1017,6 +1027,8 @@ again:
migrate_attempts));
}
+ GetTimeOfDay(&crec->lock_time);
+
memcpy(&crec->header, ctdb_data.dptr, sizeof(crec->header));
result->value.dsize = ctdb_data.dsize - sizeof(crec->header);
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index 578059a..42a0526 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -476,7 +476,7 @@ static NTSTATUS create_aio_child(struct aio_child_list *children,
if (result->pid == 0) {
close(fdpair[0]);
result->sockfd = fdpair[1];
- file_walk_table(close_fsp_fd, NULL);
+ files_forall(close_fsp_fd, NULL);
aio_child_loop(result->sockfd, result->map);
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 110916f..b593296 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -267,6 +267,7 @@ struct global {
char **szClusterAddresses;
bool clustering;
int ctdb_timeout;
+ int ctdb_locktime_warn_threshold;
int ldap_passwd_sync;
int ldap_replication_sleep;
int ldap_timeout; /* This is initialised in init_globals */
@@ -346,6 +347,7 @@ struct global {
int iIdmapCacheTime;
int iIdmapNegativeCacheTime;
bool bResetOnZeroVC;
+ bool bLogWriteableFilesOnExit;
int iKeepalive;
int iminreceivefile;
struct param_opt_struct *param_opt;
@@ -2053,6 +2055,15 @@ static struct parm_struct parm_table[] = {
.flags = FLAG_ADVANCED,
},
{
+ .label = "log writeable files on exit",
+ .type = P_BOOL,
+ .p_class = P_GLOBAL,
+ .ptr = &Globals.bLogWriteableFilesOnExit,
+ .special = NULL,
+ .enum_list = NULL,
+ .flags = FLAG_ADVANCED,
+ },
+ {
.label = "acl compatibility",
.type = P_ENUM,
.p_class = P_GLOBAL,
@@ -2541,6 +2552,15 @@ static struct parm_struct parm_table[] = {
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_GLOBAL,
},
+ {
+ .label = "ctdb locktime warn threshold",
+ .type = P_INTEGER,
+ .p_class = P_GLOBAL,
+ .ptr = &Globals.ctdb_locktime_warn_threshold,
+ .special = NULL,
+ .enum_list = NULL,
+ .flags = FLAG_ADVANCED | FLAG_GLOBAL,
+ },
{N_("Printing Options"), P_SEP, P_SEPARATOR},
@@ -5020,6 +5040,7 @@ static void init_globals(bool first_time_only)
#endif
Globals.bUnixExtensions = True;
Globals.bResetOnZeroVC = False;
+ Globals.bLogWriteableFilesOnExit = False;
Globals.bCreateKrb5Conf = true;
/* hostname lookups can be very expensive and are broken on
@@ -5095,6 +5116,7 @@ static void init_globals(bool first_time_only)
Globals.szClusterAddresses = NULL;
Globals.clustering = False;
Globals.ctdb_timeout = 0;
+ Globals.ctdb_locktime_warn_threshold = 0;
Globals.winbind_cache_time = 300; /* 5 minutes */
Globals.winbind_reconnect_delay = 30; /* 30 seconds */
@@ -5408,6 +5430,8 @@ FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
+FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
+ &Globals.bLogWriteableFilesOnExit)
FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
@@ -5525,6 +5549,7 @@ FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
+FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index ced5d61..5594568 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -206,7 +206,7 @@ void file_close_user(int vuid)
* Walk the files table until "fn" returns non-NULL
*/
-struct files_struct *file_walk_table(
+struct files_struct *files_forall(
struct files_struct *(*fn)(struct files_struct *fsp,
void *private_data),
void *private_data)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index a528866..b06bf90 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -842,6 +842,32 @@ bool reload_services(bool test)
return(ret);
}
+static struct files_struct *log_writeable_file_fn(
+ struct files_struct *fsp, void *private_data)
+{
+ bool *found = (bool *)private_data;
+ char *path;
+
+ if (!fsp->can_write) {
+ return NULL;
+ }
+ if (!(*found)) {
+ DEBUG(0, ("Writable files open at exit:\n"));
+ *found = true;
+ }
+
+ path = talloc_asprintf(talloc_tos(), "%s/%s", fsp->conn->connectpath,
+ fsp->fsp_name);
+ if (path == NULL) {
+ DEBUGADD(0, ("<NOMEM>\n"));
+ }
+
+ DEBUGADD(0, ("%s\n", path));
+
+ TALLOC_FREE(path);
+ return NULL;
+}
+
/****************************************************************************
Exit the server.
****************************************************************************/
@@ -867,6 +893,11 @@ static void exit_server_common(enum server_exit_reason how,
(negprot_global_auth_context->free)(&negprot_global_auth_context);
}
+ if (lp_log_writeable_files_on_exit()) {
+ bool found = false;
+ files_forall(log_writeable_file_fn, &found);
+ }
+
had_open_conn = conn_close_all();
invalidate_all_vuids();
--
SAMBA-CTDB repository
More information about the samba-cvs
mailing list