dsdb: Honour LDB_FLG_NOSYNC for metadata.tdb
authorAndrew Bartlett <abartlet@samba.org>
Sun, 3 Jun 2018 06:36:47 +0000 (18:36 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 4 Jun 2018 18:58:01 +0000 (20:58 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13462

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jun  4 20:58:01 CEST 2018 on sn-devel-144

source4/dsdb/samdb/ldb_modules/partition_metadata.c

index d449472..197e7b0 100644 (file)
@@ -187,7 +187,7 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
        struct partition_private_data *data;
        struct loadparm_context *lp_ctx;
        char *filename, *dirname;
-       int open_flags;
+       int open_flags, tdb_flags, ldb_flags;
        struct stat statbuf;
 
        data = talloc_get_type_abort(ldb_module_get_private(module),
@@ -237,9 +237,17 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
        lp_ctx = talloc_get_type_abort(ldb_get_opaque(ldb, "loadparm"),
                                       struct loadparm_context);
 
+       tdb_flags = lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT|TDB_SEQNUM);
+
+       ldb_flags = ldb_module_flags(ldb);
+
+       if (ldb_flags & LDB_FLG_NOSYNC) {
+               tdb_flags |= TDB_NOSYNC;
+       }
+
        data->metadata->db = tdb_wrap_open(
                data->metadata, filename, 10,
-               lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT|TDB_SEQNUM), open_flags, 0660);
+               tdb_flags, open_flags, 0660);
        if (data->metadata->db == NULL) {
                talloc_free(tmp_ctx);
                if (create) {