add additional logging when tdb_chainunlock() fails
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 9 Jun 2010 04:17:35 +0000 (14:17 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 9 Jun 2010 04:37:16 +0000 (14:37 +1000)
so we can see where it was called from when it fails

server/ctdb_call.c
server/ctdb_daemon.c
server/ctdb_ltdb_server.c

index e07b98c72d30d16803ba3626122a3ee74da36b24..180d9905ea5db68d995ca99eace0127c8667f190 100644 (file)
@@ -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) {
index 39fb4edd61dbb067019b626b52b4855b3c5622c2..0a57a8af29b37f3bfdd05cc92d90af09791331db 100644 (file)
@@ -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"));
index 9b3e7e071d0ca0d3dfe423d873cbc06493eae7f4..1ce728349beb8eaf68a45a774c1ca15498623d8a 100644 (file)
@@ -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;