svn commit: samba r10354 - in trunk/source/tdb: .

jra at samba.org jra at samba.org
Tue Sep 20 17:30:45 GMT 2005


Author: jra
Date: 2005-09-20 17:30:44 +0000 (Tue, 20 Sep 2005)
New Revision: 10354

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10354

Log:
Merge back the clear-if-first fix from Samba4. Couldn't wait tridge, sorry :-).
Jeremy.

Modified:
   trunk/source/tdb/tdb.c


Changeset:
Modified: trunk/source/tdb/tdb.c
===================================================================
--- trunk/source/tdb/tdb.c	2005-09-20 15:43:58 UTC (rev 10353)
+++ trunk/source/tdb/tdb.c	2005-09-20 17:30:44 UTC (rev 10354)
@@ -2071,6 +2071,11 @@
 		TDB_LOG((tdb, 0, "tdb_reopen: open failed (%s)\n", strerror(errno)));
 		goto fail;
 	}
+	if ((tdb->flags & TDB_CLEAR_IF_FIRST) &&
+			(tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)) {
+		TDB_LOG((tdb, 0, "tdb_reopen: failed to obtain active lock\n"));
+		goto fail;
+	}
 	if (fstat(tdb->fd, &st) != 0) {
 		TDB_LOG((tdb, 0, "tdb_reopen: fstat failed (%s)\n", strerror(errno)));
 		goto fail;
@@ -2080,10 +2085,6 @@
 		goto fail;
 	}
 	tdb_mmap(tdb);
-	if ((tdb->flags & TDB_CLEAR_IF_FIRST) && (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)) {
-		TDB_LOG((tdb, 0, "tdb_reopen: failed to obtain active lock\n"));
-		goto fail;
-	}
 
 	return 0;
 
@@ -2098,8 +2099,6 @@
 	TDB_CONTEXT *tdb;
 
 	for (tdb=tdbs; tdb; tdb = tdb->next) {
-		/* Ensure no clear-if-first. */
-		tdb->flags &= ~TDB_CLEAR_IF_FIRST;
 		if (tdb_reopen(tdb) != 0)
 			return -1;
 	}



More information about the samba-cvs mailing list