svn commit: samba r14955 - in trunk/source: nsswitch smbd tdb
jra at samba.org
jra at samba.org
Thu Apr 6 22:31:49 GMT 2006
Author: jra
Date: 2006-04-06 22:31:47 +0000 (Thu, 06 Apr 2006)
New Revision: 14955
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14955
Log:
Fix #3569 based on William Jojo's work. AIX also
has the linear posix locking issue which causes
CLEAR_IF_FIRST to cause performance problems.
As we know we're in a daemon architecture with
long-lived parent we can avoid this in the Samba
case. Add a comment explaining this.
Jeremy.
Modified:
trunk/source/nsswitch/winbindd_dual.c
trunk/source/smbd/server.c
trunk/source/tdb/tdb.c
trunk/source/tdb/tdb.h
trunk/source/tdb/tdbtorture.c
Changeset:
Modified: trunk/source/nsswitch/winbindd_dual.c
===================================================================
--- trunk/source/nsswitch/winbindd_dual.c 2006-04-06 22:31:45 UTC (rev 14954)
+++ trunk/source/nsswitch/winbindd_dual.c 2006-04-06 22:31:47 UTC (rev 14955)
@@ -629,7 +629,7 @@
close(fdpair[1]);
/* tdb needs special fork handling */
- if (tdb_reopen_all() == -1) {
+ if (tdb_reopen_all(1) == -1) {
DEBUG(0,("tdb_reopen_all failed.\n"));
_exit(0);
}
Modified: trunk/source/smbd/server.c
===================================================================
--- trunk/source/smbd/server.c 2006-04-06 22:31:45 UTC (rev 14954)
+++ trunk/source/smbd/server.c 2006-04-06 22:31:47 UTC (rev 14955)
@@ -474,7 +474,7 @@
set_need_random_reseed();
/* tdb needs special fork handling - remove CLEAR_IF_FIRST flags */
- if (tdb_reopen_all() == -1) {
+ if (tdb_reopen_all(1) == -1) {
DEBUG(0,("tdb_reopen_all failed.\n"));
smb_panic("tdb_reopen_all failed.");
}
Modified: trunk/source/tdb/tdb.c
===================================================================
--- trunk/source/tdb/tdb.c 2006-04-06 22:31:45 UTC (rev 14954)
+++ trunk/source/tdb/tdb.c 2006-04-06 22:31:47 UTC (rev 14955)
@@ -2098,11 +2098,27 @@
}
/* reopen all tdb's */
-int tdb_reopen_all(void)
+int tdb_reopen_all(int parent_longlived)
{
TDB_CONTEXT *tdb;
for (tdb=tdbs; tdb; tdb = tdb->next) {
+ /*
+ * If the parent is longlived (ie. a
+ * parent daemon architecture), we know
+ * it will keep it's active lock on a
+ * tdb opened with CLEAR_IF_FIRST. Thus
+ * for child processes we don't have to
+ * add an active lock. This is essential
+ * to improve performance on systems that
+ * keep POSIX locks as a non-scalable data
+ * structure in the kernel.
+ */
+ if (parent_longlived) {
+ /* Ensure no clear-if-first. */
+ tdb->flags &= ~TDB_CLEAR_IF_FIRST;
+ }
+
if (tdb_reopen(tdb) != 0)
return -1;
}
Modified: trunk/source/tdb/tdb.h
===================================================================
--- trunk/source/tdb/tdb.h 2006-04-06 22:31:45 UTC (rev 14954)
+++ trunk/source/tdb/tdb.h 2006-04-06 22:31:47 UTC (rev 14955)
@@ -128,7 +128,7 @@
tdb_hash_func hash_fn);
int tdb_reopen(TDB_CONTEXT *tdb);
-int tdb_reopen_all(void);
+int tdb_reopen_all(int);
void tdb_logging_function(TDB_CONTEXT *tdb, tdb_log_func);
enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb);
const char *tdb_errorstr(TDB_CONTEXT *tdb);
Modified: trunk/source/tdb/tdbtorture.c
===================================================================
--- trunk/source/tdb/tdbtorture.c 2006-04-06 22:31:45 UTC (rev 14954)
+++ trunk/source/tdb/tdbtorture.c 2006-04-06 22:31:47 UTC (rev 14955)
@@ -103,7 +103,7 @@
#if REOPEN_PROB
if (random() % REOPEN_PROB == 0) {
- tdb_reopen_all();
+ tdb_reopen_all(1);
goto next;
}
#endif
@@ -192,7 +192,7 @@
for (i=0;i<NPROC;i++) {
pids[i] = fork();
if (pids[i] == 0) {
- tdb_reopen_all();
+ tdb_reopen_all(1);
tdb_logging_function(db, tdb_log);
More information about the samba-cvs
mailing list