From: Ronnie Sahlberg Date: Wed, 9 Jun 2010 04:17:35 +0000 (+1000) Subject: add additional logging when tdb_chainunlock() fails X-Git-Tag: ctdb-1.9.1~16 X-Git-Url: http://git.samba.org/?p=rusty%2Fctdb.git;a=commitdiff_plain;h=0c091b3db6bdefd371787d87bc749593ea8e3c76 add additional logging when tdb_chainunlock() fails so we can see where it was called from when it fails --- diff --git a/server/ctdb_call.c b/server/ctdb_call.c index e07b98c7..180d9905 100644 --- a/server/ctdb_call.c +++ b/server/ctdb_call.c @@ -245,6 +245,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db, struct ctdb_call_state *state; struct ctdb_context *ctdb = ctdb_db->ctdb; struct ctdb_ltdb_header header; + int ret; DEBUG(DEBUG_DEBUG,("pnn %u dmaster response %08x\n", ctdb->pnn, ctdb_hash(&key))); @@ -254,7 +255,11 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db, if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) { ctdb_fatal(ctdb, "ctdb_reply_dmaster store failed\n"); - ctdb_ltdb_unlock(ctdb_db, key); + + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } return; } @@ -263,20 +268,31 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db, if (state == NULL) { DEBUG(DEBUG_ERR,("pnn %u Invalid reqid %u in ctdb_become_dmaster from node %u\n", ctdb->pnn, hdr->reqid, hdr->srcnode)); - ctdb_ltdb_unlock(ctdb_db, key); + + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } return; } if (hdr->reqid != state->reqid) { /* we found a record but it was the wrong one */ DEBUG(DEBUG_ERR, ("Dropped orphan in ctdb_become_dmaster with reqid:%u\n from node %u", hdr->reqid, hdr->srcnode)); - ctdb_ltdb_unlock(ctdb_db, key); + + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } return; } ctdb_call_local(ctdb_db, state->call, &header, state, &data, ctdb->pnn); - ctdb_ltdb_unlock(ctdb_db, state->call->key); + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } state->state = CTDB_CALL_DONE; if (state->async.fn) { diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c index 39fb4edd..0a57a8af 100644 --- a/server/ctdb_daemon.c +++ b/server/ctdb_daemon.c @@ -401,7 +401,11 @@ static void daemon_request_call_from_client(struct ctdb_client *client, dstate = talloc(client, struct daemon_call_state); if (dstate == NULL) { - ctdb_ltdb_unlock(ctdb_db, key); + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } + DEBUG(DEBUG_ERR,(__location__ " Unable to allocate dstate\n")); if (client->ctdb->statistics.pending_calls > 0) { ctdb->statistics.pending_calls--; @@ -415,7 +419,11 @@ static void daemon_request_call_from_client(struct ctdb_client *client, call = dstate->call = talloc_zero(dstate, struct ctdb_call); if (call == NULL) { - ctdb_ltdb_unlock(ctdb_db, key); + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } + DEBUG(DEBUG_ERR,(__location__ " Unable to allocate call\n")); if (client->ctdb->statistics.pending_calls > 0) { ctdb->statistics.pending_calls--; @@ -436,7 +444,10 @@ static void daemon_request_call_from_client(struct ctdb_client *client, state = ctdb_daemon_call_send_remote(ctdb_db, call, &header); } - ctdb_ltdb_unlock(ctdb_db, key); + ret = ctdb_ltdb_unlock(ctdb_db, key); + if (ret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", ret)); + } if (state == NULL) { DEBUG(DEBUG_ERR,(__location__ " Unable to setup call send\n")); diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c index 9b3e7e07..1ce72834 100644 --- a/server/ctdb_ltdb_server.c +++ b/server/ctdb_ltdb_server.c @@ -170,7 +170,11 @@ int ctdb_ltdb_lock_fetch_requeue(struct ctdb_db_context *ctdb_db, if (ret == 0) { ret = ctdb_ltdb_fetch(ctdb_db, key, header, hdr, data); if (ret != 0) { - ctdb_ltdb_unlock(ctdb_db, key); + int uret; + uret = ctdb_ltdb_unlock(ctdb_db, key); + if (uret != 0) { + DEBUG(DEBUG_ERR,(__location__ " ctdb_ltdb_unlock() failed with error %d\n", uret)); + } } } return ret;