Author: jra Date: 2005-09-20 17:33:07 +0000 (Tue, 20 Sep 2005) New Revision: 10355
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10355 Log: Merge back the clear-if-first fix from Samba4. Couldn't wait tridge, sorry :-). Jeremy. Modified: branches/SAMBA_3_0/source/tdb/tdb.c Changeset: Modified: branches/SAMBA_3_0/source/tdb/tdb.c =================================================================== --- branches/SAMBA_3_0/source/tdb/tdb.c 2005-09-20 17:30:44 UTC (rev 10354) +++ branches/SAMBA_3_0/source/tdb/tdb.c 2005-09-20 17:33:07 UTC (rev 10355) @@ -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; }