[SCM] Samba Shared Repository - branch v3-4-stable updated - release-3-4-0-30-ge7b3192
Karolin Seeger
kseeger at samba.org
Fri Aug 14 02:56:35 MDT 2009
The branch, v3-4-stable has been updated
via e7b3192b804148b4243b99a7d5b90967e3d20e8d (commit)
via ce20295f120a921d24f0205a866727b3d2cc2784 (commit)
via f2d4ff4c8d60001043786f7a82468c0dc12692c0 (commit)
from c25e8597214b7167c557a86352ab3f0f8a7d6b94 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-stable
- Log -----------------------------------------------------------------
commit e7b3192b804148b4243b99a7d5b90967e3d20e8d
Author: Karolin Seeger <kseeger at samba.org>
Date: Fri Aug 14 10:36:42 2009 +0200
WHATSNEW: Update changes since 3.4.0.
Karolin
(cherry picked from commit 9b90ee43683c78ed2ddf2f24b8b1afaa943ff348)
commit ce20295f120a921d24f0205a866727b3d2cc2784
Author: Rusty Russell <rusty at rustcorp.com.au>
Date: Thu Jul 30 11:52:08 2009 +0930
tdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop".
This version just wraps the reopen code, so we still re-grab the lock and do
the normal sanity checks.
The reason we do this at all is to avoid global fd limits, see:
http://forums.fedoraforum.org/showthread.php?t=210393
Note also that this whole reopen concept is fundamentally racy: if the parent
goes away before the child calls tdb_reopen_all, the database can be left
without an active lock and another TDB_CLEAR_IF_FIRST opener will clear it.
A fork_with_tdbs() wrapper could use a pipe to solve this, but it's hardly
elegant (what if there are other independent things which have similar needs?).
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit 3b2f074bda8734a0b30a3e31117c0217d890809c)
Addresses bug #6601.
(cherry picked from commit 5d1e254188373de838cfe046118267701ee6cd5a)
commit f2d4ff4c8d60001043786f7a82468c0dc12692c0
Author: Rusty Russell <rusty at rustcorp.com.au>
Date: Thu Jul 30 11:51:28 2009 +0930
tdb: Revert "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop"
This reverts commit e17df483fbedb81aededdef5fbb6ae1d034bc2dd.
tdb_reopen_all also restores the active lock, required for TDB_CLEAR_IF_FIRST.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
(cherry picked from commit fa91bc67199f0d45a0e570b43aeafd816a5491bf)
(cherry picked from commit f1cf84c9b9abc48a58355400acb63fd79e1d60c4)
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 4 ++++
lib/tdb/common/open.c | 20 ++++++++++----------
2 files changed, 14 insertions(+), 10 deletions(-)
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 4e40c97..fb63551 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -56,6 +56,10 @@ o Tim Prouty <tprouty at samba.org>
* BUG 6620: Fix a bug in renames of directories.
+o Rusty Russell <rusty at rustcorp.com.au>
+ * BUG 6601: Avoid global fd limits.
+
+
o Jelmer Vernooij <jelmer at samba.org>
* Fix build with external talloc.
diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c
index e58c8ca..49b8e85 100644
--- a/lib/tdb/common/open.c
+++ b/lib/tdb/common/open.c
@@ -425,6 +425,9 @@ int tdb_reopen(struct tdb_context *tdb)
goto fail;
}
+/* If we have real pread & pwrite, we can skip reopen. */
+#if !defined(LIBREPLACE_PREAD_NOT_REPLACED) || \
+ !defined(LIBREPLACE_PWRITE_NOT_REPLACED)
if (tdb_munmap(tdb) != 0) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: munmap failed (%s)\n", strerror(errno)));
goto fail;
@@ -436,11 +439,6 @@ int tdb_reopen(struct tdb_context *tdb)
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: open failed (%s)\n", strerror(errno)));
goto fail;
}
- if ((tdb->flags & TDB_CLEAR_IF_FIRST) &&
- (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1)) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: failed to obtain active lock\n"));
- goto fail;
- }
if (fstat(tdb->fd, &st) != 0) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: fstat failed (%s)\n", strerror(errno)));
goto fail;
@@ -450,6 +448,13 @@ int tdb_reopen(struct tdb_context *tdb)
goto fail;
}
tdb_mmap(tdb);
+#endif /* fake pread or pwrite */
+
+ if ((tdb->flags & TDB_CLEAR_IF_FIRST) &&
+ (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1)) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: failed to obtain active lock\n"));
+ goto fail;
+ }
return 0;
@@ -461,10 +466,6 @@ fail:
/* reopen all tdb's */
int tdb_reopen_all(int parent_longlived)
{
-#if defined(LIBREPLACE_PREAD_NOT_REPLACED) && \
- defined(LIBREPLACE_PWRITE_NOT_REPLACED)
- return 0;
-#else
struct tdb_context *tdb;
for (tdb=tdbs; tdb; tdb = tdb->next) {
@@ -487,7 +488,6 @@ int tdb_reopen_all(int parent_longlived)
if (tdb_reopen(tdb) != 0)
return -1;
}
-#endif
return 0;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list