From: Andrew Tridgell Date: Thu, 7 Aug 2008 13:26:22 +0000 (+1000) Subject: put a limit on the number of retries. I found a case where a recovery X-Git-Tag: samba-3.3.0pre1~146 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a633390d3a7cb04a7c4e14cba9c533621793287e;p=thirdparty%2Fsamba.git put a limit on the number of retries. I found a case where a recovery could lead to it blocking forever --- diff --git a/source/lib/dbwrap_ctdb.c b/source/lib/dbwrap_ctdb.c index 16c626632de..645b93846ba 100644 --- a/source/lib/dbwrap_ctdb.c +++ b/source/lib/dbwrap_ctdb.c @@ -597,6 +597,7 @@ static int db_ctdb_transaction_commit(struct db_context *db) NTSTATUS rets; int ret; int status; + int retries = 0; struct db_ctdb_transaction_handle *h = ctx->transaction; if (h == NULL) { @@ -648,6 +649,17 @@ again: ctx->transaction = NULL; return -1; } + if (retries++ == 10) { + DEBUG(0,(__location__ " Giving up transaction on db 0x%08x after %d retries\n", + h->ctx->db_id, retries)); + ctdbd_control_local(messaging_ctdbd_connection(), CTDB_CONTROL_TRANS2_ERROR, + h->ctx->db_id, CTDB_CTRL_FLAG_NOREPLY, + tdb_null, NULL, NULL, NULL); + h->ctx->transaction = NULL; + talloc_free(h); + ctx->transaction = NULL; + return -1; + } goto again; }