locking: Add handler function for unlocking a database
authorAmitay Isaacs <amitay@gmail.com>
Tue, 30 Apr 2013 04:06:46 +0000 (14:06 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 23 May 2013 23:06:39 +0000 (09:06 +1000)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
server/ctdb_lock.c

index 6e7d5df83c3f72cca24cf4ba0ef6a499ae776695..5b183fc003648c5351f010ff13131fcd7c8551ec 100644 (file)
@@ -200,6 +200,26 @@ static int ctdb_lockall(struct ctdb_context *ctdb)
 /*
  * unlock all databases
  */
+static int db_unlock_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
+                            void *private_data)
+{
+       if (priority == 0) {
+               DEBUG(DEBUG_INFO, ("unlocking database %s\n",
+                                  ctdb_db->db_name));
+       } else {
+               DEBUG(DEBUG_INFO, ("unlocking database %s, priority:%u\n",
+                                  ctdb_db->db_name, priority));
+       }
+
+       if (tdb_unlockall(ctdb_db->ltdb->tdb) != 0) {
+               DEBUG(DEBUG_ERR, ("Failed to unlock database %s\n",
+                                 ctdb_db->db_name));
+               return -1;
+       }
+
+       return 0;
+}
+
 int ctdb_unlockall_prio(struct ctdb_context *ctdb, uint32_t priority)
 {
        struct ctdb_db_context *ctdb_db;