diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-10-27 12:13:46 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-10-27 12:13:46 +1100 |
commit | ab4d06909498c2fa7b22e6abcf7705aa807d0bf4 (patch) | |
tree | 8d64e04d33d202847baaf6086d0052c79bcb7574 /source4/dsdb | |
parent | 6afac82e4b2e09262cf3151bc87a82c5abb39932 (diff) | |
download | samba-ab4d06909498c2fa7b22e6abcf7705aa807d0bf4.tar.gz samba-ab4d06909498c2fa7b22e6abcf7705aa807d0bf4.tar.bz2 samba-ab4d06909498c2fa7b22e6abcf7705aa807d0bf4.zip |
s4-dsdb: always cancel transactions on all partitions
If we get an error ending a transaction on one partition we need to
continue on the other partitions.
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index a36ab3a7d9..01ae0a10a7 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -703,33 +703,39 @@ static int partition_prepare_commit(struct ldb_module *module) /* end a transaction */ static int partition_end_trans(struct ldb_module *module) { - int i; + int i, ret, ret2; struct partition_private_data *data = talloc_get_type(module->private_data, struct partition_private_data); - for (i=0; data && data->partitions && data->partitions[i]; i++) { - int ret; + ret = LDB_SUCCESS; + + if (data->in_transaction == 0) { + DEBUG(0,("partition end transaction mismatch\n")); + ret = LDB_ERR_OPERATIONS_ERROR; + } else { + data->in_transaction--; + } + + for (i=0; data && data->partitions && data->partitions[i]; i++) { if ((module && module->ldb->flags & LDB_FLG_ENABLE_TRACING)) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "partition_end_trans() -> %s", ldb_dn_get_linearized(data->partitions[i]->ctrl->dn)); } - ret = ldb_next_end_trans(data->partitions[i]->module); - if (ret != LDB_SUCCESS) { + ret2 = ldb_next_end_trans(data->partitions[i]->module); + if (ret2 != LDB_SUCCESS) { ldb_asprintf_errstring(module->ldb, "end_trans error on %s: %s", ldb_dn_get_linearized(data->partitions[i]->ctrl->dn), ldb_errstring(module->ldb)); - return ret; + ret = ret2; } } - if (data->in_transaction == 0) { - DEBUG(0,("partition end transaction mismatch\n")); - return LDB_ERR_OPERATIONS_ERROR; - } - data->in_transaction--; - if ((module && module->ldb->flags & LDB_FLG_ENABLE_TRACING)) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "partition_end_trans() -> (metadata partition)"); } - return ldb_next_end_trans(module); + ret2 = ldb_next_end_trans(module); + if (ret2 != LDB_SUCCESS) { + ret = ret2; + } + return ret; } /* delete a transaction */ |