diff options
author | Jeremy Allison <jra@samba.org> | 2005-09-20 17:33:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:03:41 -0500 |
commit | b3b2910f8fbcd12a717e6b9090a87a8db87c339f (patch) | |
tree | b6941326050053871897f1018485755c859c1e77 /source3 | |
parent | 7bd1888cdf95b0e32fe1a2993d7bcb2b16e475b1 (diff) | |
download | samba-b3b2910f8fbcd12a717e6b9090a87a8db87c339f.tar.gz samba-b3b2910f8fbcd12a717e6b9090a87a8db87c339f.tar.bz2 samba-b3b2910f8fbcd12a717e6b9090a87a8db87c339f.zip |
r10355: Merge back the clear-if-first fix from Samba4. Couldn't wait tridge, sorry :-).
Jeremy.
(This used to be commit b1722b7bd1eaabb725218a4fc5c8b012f0a1a0af)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/tdb/tdb.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c index 908657b355..5d70c046d3 100644 --- a/source3/tdb/tdb.c +++ b/source3/tdb/tdb.c @@ -2071,6 +2071,11 @@ int tdb_reopen(TDB_CONTEXT *tdb) 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 @@ int tdb_reopen(TDB_CONTEXT *tdb) 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 @@ int tdb_reopen_all(void) 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; } |