diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-11-19 09:34:05 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-12-16 08:03:54 +0100 |
commit | 5cbf0183f34c34216e2541869581977be6926fbe (patch) | |
tree | 7321248ab7ca1bf329221a8f4808dc7fec4ac6bb /ctdb/lib/tdb/common/open.c | |
parent | b768146ef5b3aefb7b0769f1f3ff72a581b4dd48 (diff) | |
download | samba-5cbf0183f34c34216e2541869581977be6926fbe.tar.gz samba-5cbf0183f34c34216e2541869581977be6926fbe.tar.xz samba-5cbf0183f34c34216e2541869581977be6926fbe.zip |
tdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behavior
We need to keep TDB_ALLOW_NESTING as default behavior,
so that existing code continues to work.
However we may change the default together with a major version
number change in future.
metze
(cherry picked from samba commit 3b9f19ed919fef2e88b2f92ae541e07bc7379cd1)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be ctdb commit c1c0ede32dc00ed619d1cf5fda40a9de43995f3a)
Diffstat (limited to 'ctdb/lib/tdb/common/open.c')
-rw-r--r-- | ctdb/lib/tdb/common/open.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ctdb/lib/tdb/common/open.c b/ctdb/lib/tdb/common/open.c index 4ea4499dc14..4d4f95a3daa 100644 --- a/ctdb/lib/tdb/common/open.c +++ b/ctdb/lib/tdb/common/open.c @@ -202,6 +202,23 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->flags &= ~TDB_CLEAR_IF_FIRST; } + if ((tdb->flags & TDB_ALLOW_NESTING) && + (tdb->flags & TDB_DISALLOW_NESTING)) { + tdb->ecode = TDB_ERR_NESTING; + TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " + "allow_nesting and disallow_nesting are not allowed together!")); + errno = EINVAL; + goto fail; + } + + /* + * TDB_ALLOW_NESTING is the default behavior. + * Note: this may change in future versions! + */ + if (!(tdb->flags & TDB_DISALLOW_NESTING)) { + tdb->flags |= TDB_ALLOW_NESTING; + } + /* internal databases don't mmap or lock, and start off cleared */ if (tdb->flags & TDB_INTERNAL) { tdb->flags |= (TDB_NOLOCK | TDB_NOMMAP); |