ctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls
authorStefan Metzmacher <metze@samba.org>
Fri, 20 Nov 2009 20:17:59 +0000 (21:17 +0100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 16 Dec 2009 07:26:26 +0000 (18:26 +1100)
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
client/ctdb_client.c
server/ctdb_ltdb_server.c
server/ctdb_recoverd.c
server/ctdb_vacuum.c
tools/ctdb_vacuum.c

index 0469ba7280764259a1c5199a3e99a1d2679804d3..b623bfe352172e41018a0a4dbe28371eb8ec6875 100644 (file)
@@ -1686,6 +1686,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
        if (!ctdb->do_setsched) {
                tdb_flags |= TDB_NOMMAP;
        }
+       tdb_flags |= TDB_DISALLOW_NESTING;
 
        ctdb_db->ltdb = tdb_wrap_open(ctdb, ctdb_db->db_path, 0, tdb_flags, O_RDWR, 0);
        if (ctdb_db->ltdb == NULL) {
index 37abe116daf82ebc90424bf100d43699fc17a2d7..92228e228782d130991a394e0e7f9f14a130e5cb 100644 (file)
@@ -251,6 +251,7 @@ static int ctdb_local_attach(struct ctdb_context *ctdb, const char *db_name, boo
        if (!ctdb->do_setsched) {
                tdb_flags |= TDB_NOMMAP;
        }
+       tdb_flags |= TDB_DISALLOW_NESTING;
 
        ctdb_db->ltdb = tdb_wrap_open(ctdb, ctdb_db->db_path, 
                                      ctdb->tunable.database_hash_size, 
index 3e596da9ecad9d88c8aa99184e4c94dac10a7720..e05eef02fea98ed3759ef836bed49f7fba9555c1 100644 (file)
@@ -1020,6 +1020,7 @@ static struct tdb_wrap *create_recdb(struct ctdb_context *ctdb, TALLOC_CTX *mem_
        if (!ctdb->do_setsched) {
                tdb_flags |= TDB_NOMMAP;
        }
+       tdb_flags |= TDB_DISALLOW_NESTING;
 
        recdb = tdb_wrap_open(mem_ctx, name, ctdb->tunable.database_hash_size, 
                              tdb_flags, O_RDWR|O_CREAT|O_EXCL, 0600);
index d09c07d9ff266d9495265fb5f20090e238faa739..0ab52801d62caf2f31e366167d8fc54ddad66c80 100644 (file)
@@ -435,7 +435,9 @@ static int ctdb_repack_tdb(struct tdb_context *tdb, TALLOC_CTX *mem_ctx, struct
                return -1;
        }
 
-       tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0);
+       tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb),
+                         TDB_INTERNAL|TDB_DISALLOW_NESTING,
+                         O_RDWR|O_CREAT, 0);
        if (tmp_db == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Failed to create tmp_db\n"));
                tdb_transaction_cancel(tdb);
@@ -524,7 +526,9 @@ static int update_tuning_db(struct ctdb_db_context *ctdb_db, struct vacuum_data
                return -1;
        }
 
-       tune_tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0644);
+       tune_tdb = tdb_open(vac_dbname, 0,
+                           TDB_DISALLOW_NESTING,
+                           O_RDWR|O_CREAT, 0644);
        if (tune_tdb == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Failed to create/open %s\n", TUNINGDBNAME));
                talloc_free(tmp_ctx);
@@ -685,7 +689,9 @@ static int get_vacuum_interval(struct ctdb_db_context *ctdb_db)
                return interval;
        }
 
-       tdb = tdb_open(vac_dbname, 0, 0, O_RDWR|O_CREAT, 0644);
+       tdb = tdb_open(vac_dbname, 0,
+                      TDB_DISALLOW_NESTING,
+                      O_RDWR|O_CREAT, 0644);
        if (!tdb) {
                DEBUG(DEBUG_ERR,("Unable to open/create database %s using default interval\n", vac_dbname));
                talloc_free(tmp_ctx);
index f517c6ea7199d7eb2a980066cd68ddd87680bceb..bd45287f2ce7f5c205877ac6ffe24aa65cfe6a7d 100644 (file)
@@ -507,7 +507,9 @@ static int ctdb_repack_tdb(struct tdb_context *tdb)
                return -1;
        }
 
-       tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0);
+       tmp_db = tdb_open("tmpdb", tdb_hash_size(tdb),
+                         TDB_INTERNAL|TDB_DISALLOW_NESTING,
+                         O_RDWR|O_CREAT, 0);
        if (tmp_db == NULL) {
                DEBUG(DEBUG_ERR,(__location__ " Failed to create tmp_db\n"));
                tdb_transaction_cancel(tdb);