summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-08-08 10:55:11 +1000
committerMichael Adam <obnox@samba.org>2008-08-13 11:54:10 +0200
commit0f8a6859e63b5d842caf231e7003732051815963 (patch)
treeec925633b03f05da7bc0f56a5a41b6fe8f62c2eb /source3
parent1349e94d21419477970abe1d489775ba77d7b4ee (diff)
downloadsamba-0f8a6859e63b5d842caf231e7003732051815963.tar.gz
samba-0f8a6859e63b5d842caf231e7003732051815963.tar.bz2
samba-0f8a6859e63b5d842caf231e7003732051815963.zip
cope with the control failing completely without returning a status
(This used to be commit fe6a03e7b11cd859fddae5ba924ea5e071b8ccea)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/dbwrap_ctdb.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index bd062b368a..8efc1ea290 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -652,17 +652,21 @@ again:
tdb_transaction_cancel(h->ctx->wtdb->tdb);
sleep(1);
- /* work out what error code we will give if we
- have to fail the operation */
- switch ((enum ctdb_trans2_commit_error)status) {
- case CTDB_TRANS2_COMMIT_SUCCESS:
- case CTDB_TRANS2_COMMIT_SOMEFAIL:
- case CTDB_TRANS2_COMMIT_TIMEOUT:
- failure_control = CTDB_CONTROL_TRANS2_ERROR;
- break;
- case CTDB_TRANS2_COMMIT_ALLFAIL:
- failure_control = CTDB_CONTROL_TRANS2_FINISHED;
- break;
+ if (!NT_STATUS_IS_OK(rets)) {
+ failure_control = CTDB_CONTROL_TRANS2_ERROR;
+ } else {
+ /* work out what error code we will give if we
+ have to fail the operation */
+ switch ((enum ctdb_trans2_commit_error)status) {
+ case CTDB_TRANS2_COMMIT_SUCCESS:
+ case CTDB_TRANS2_COMMIT_SOMEFAIL:
+ case CTDB_TRANS2_COMMIT_TIMEOUT:
+ failure_control = CTDB_CONTROL_TRANS2_ERROR;
+ break;
+ case CTDB_TRANS2_COMMIT_ALLFAIL:
+ failure_control = CTDB_CONTROL_TRANS2_FINISHED;
+ break;
+ }
}
if (ctdb_replay_transaction(h) != 0) {
@@ -687,13 +691,15 @@ again:
return -1;
}
goto again;
+ } else {
+ failure_control = CTDB_CONTROL_TRANS2_ERROR;
}
/* do the real commit locally */
ret = tdb_transaction_commit(h->ctx->wtdb->tdb);
if (ret != 0) {
DEBUG(0,(__location__ " Failed to commit transaction\n"));
- ctdbd_control_local(messaging_ctdbd_connection(), CTDB_CONTROL_TRANS2_ERROR, h->ctx->db_id,
+ ctdbd_control_local(messaging_ctdbd_connection(), failure_control, h->ctx->db_id,
CTDB_CTRL_FLAG_NOREPLY, tdb_null, NULL, NULL, NULL);
h->ctx->transaction = NULL;
talloc_free(h);