From fce0dcf2450f68fdc201152bdd063569bdcf1770 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 17 Apr 2006 11:42:59 +0000 Subject: r15100: Port the bugfix for #3569 to Samba4 (This used to be commit 5f1d52f232051324082b840f29dd7719a9328bd5) --- source4/lib/tdb/common/open.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source4/lib/tdb/common/open.c') diff --git a/source4/lib/tdb/common/open.c b/source4/lib/tdb/common/open.c index 7ebc067175..cb4a9cd994 100644 --- a/source4/lib/tdb/common/open.c +++ b/source4/lib/tdb/common/open.c @@ -424,11 +424,27 @@ fail: } /* reopen all tdb's */ -int tdb_reopen_all(void) +int tdb_reopen_all(int parent_longlived) { struct 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; } -- cgit