locking: Add handler function for unmarking a database
authorAmitay Isaacs <amitay@gmail.com>
Tue, 30 Apr 2013 04:16:07 +0000 (14:16 +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 6bc1a100cebaf16d6ebd91bedc7131f92ff2b3fa..30be27bd3f0e1685b63ee60ac283e05a0136383b 100644 (file)
@@ -299,6 +299,29 @@ static int ctdb_lockall_mark(struct ctdb_context *ctdb)
 /*
  * lock all databases - unmark only
  */
+static int db_lock_unmark_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
+                                 void *private_data)
+{
+       int tdb_transaction_write_lock_unmark(struct tdb_context *);
+
+       DEBUG(DEBUG_INFO, ("unmarking locked database %s, priority:%u\n",
+                          ctdb_db->db_name, priority));
+
+       if (tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb) != 0) {
+               DEBUG(DEBUG_ERR, ("Failed to unmark (transaction lock) database %s\n",
+                                 ctdb_db->db_name));
+               return -1;
+       }
+
+       if (tdb_lockall_unmark(ctdb_db->ltdb->tdb) != 0) {
+               DEBUG(DEBUG_ERR, ("Failed to unmark (all lock) database %s\n",
+                                 ctdb_db->db_name));
+               return -1;
+       }
+
+       return 0;
+}
+
 int ctdb_lockall_unmark_prio(struct ctdb_context *ctdb, uint32_t priority)
 {
        struct ctdb_db_context *ctdb_db;