3 provide API to do non-blocking locks for single or all databases
5 Copyright (C) Amitay Isaacs 2012
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include "include/ctdb_private.h"
22 #include "include/ctdb_protocol.h"
26 #include "system/filesys.h"
27 #include "lib/util/dlinklist.h"
30 * Non-blocking Locking API
32 * 1. Create a child process to do blocking locks.
33 * 2. Once the locks are obtained, signal parent process via fd.
34 * 3. Invoke registered callback routine with locking status.
35 * 4. If the child process cannot get locks within certain time,
36 * diagnose using /proc/locks and log warning message
38 * ctdb_lock_record() - get a lock on a record
39 * ctdb_lock_db() - get a lock on a DB
40 * ctdb_lock_alldb_prio() - get a lock on all DBs with given priority
41 * ctdb_lock_alldb() - get a lock on all DBs
43 * auto_mark - whether to mark/unmark DBs in before/after callback
46 /* FIXME: Add a tunable max_lock_processes_per_db */
47 #define MAX_LOCK_PROCESSES_PER_DB (100)
56 static const char * const lock_type_str[] = {
65 /* lock_context is the common part for a lock request */
67 struct lock_context *next, *prev;
69 struct ctdb_context *ctdb;
70 struct ctdb_db_context *ctdb_db;
74 struct lock_request *req_queue;
77 struct tevent_fd *tfd;
78 struct tevent_timer *ttimer;
81 struct timeval start_time;
84 /* lock_request is the client specific part for a lock request */
86 struct lock_request *next, *prev;
87 struct lock_context *lctx;
88 void (*callback)(void *, bool);
94 * Support samba 3.6.x (and older) versions which do not set db priority.
96 * By default, all databases are set to priority 1. So only when priority
97 * is set to 1, check for databases that need higher priority.
99 static bool later_db(struct ctdb_context *ctdb, const char *name)
101 if (ctdb->tunable.samba3_hack == 0) {
105 if (strstr(name, "brlock") ||
106 strstr(name, "g_lock") ||
107 strstr(name, "notify_onelevel") ||
108 strstr(name, "serverid") ||
109 strstr(name, "xattr_tdb")) {
116 typedef int (*db_handler_t)(struct ctdb_db_context *ctdb_db,
120 static int ctdb_db_iterator(struct ctdb_context *ctdb, uint32_t priority,
121 db_handler_t handler, void *private_data)
123 struct ctdb_db_context *ctdb_db;
126 for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) {
127 if (ctdb_db->priority != priority) {
130 if (later_db(ctdb, ctdb_db->db_name)) {
133 ret = handler(ctdb_db, priority, private_data);
139 /* If priority != 1, later_db check is not required and can return */
144 for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) {
145 if (!later_db(ctdb, ctdb_db->db_name)) {
148 ret = handler(ctdb_db, priority, private_data);
159 * lock all databases - mark only
161 static int db_lock_mark_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
164 int tdb_transaction_write_lock_mark(struct tdb_context *);
166 DEBUG(DEBUG_INFO, ("marking locked database %s, priority:%u\n",
167 ctdb_db->db_name, priority));
169 if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) {
170 DEBUG(DEBUG_ERR, ("Failed to mark (transaction lock) database %s\n",
175 if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) {
176 DEBUG(DEBUG_ERR, ("Failed to mark (all lock) database %s\n",
184 int ctdb_lockall_mark_prio(struct ctdb_context *ctdb, uint32_t priority)
187 * This function is only used by the main dameon during recovery.
188 * At this stage, the databases have already been locked, by a
189 * dedicated child process. The freeze_mode variable is used to track
190 * whether the actual locks are held by the child process or not.
193 if (ctdb->freeze_mode[priority] != CTDB_FREEZE_FROZEN) {
194 DEBUG(DEBUG_ERR, ("Attempt to mark all databases locked when not frozen\n"));
198 return ctdb_db_iterator(ctdb, priority, db_lock_mark_handler, NULL);
201 static int ctdb_lockall_mark(struct ctdb_context *ctdb)
205 for (priority=1; priority<=NUM_DB_PRIORITIES; priority++) {
206 if (ctdb_db_iterator(ctdb, priority, db_lock_mark_handler, NULL) != 0) {
216 * lock all databases - unmark only
218 static int db_lock_unmark_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
221 int tdb_transaction_write_lock_unmark(struct tdb_context *);
223 DEBUG(DEBUG_INFO, ("unmarking locked database %s, priority:%u\n",
224 ctdb_db->db_name, priority));
226 if (tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb) != 0) {
227 DEBUG(DEBUG_ERR, ("Failed to unmark (transaction lock) database %s\n",
232 if (tdb_lockall_unmark(ctdb_db->ltdb->tdb) != 0) {
233 DEBUG(DEBUG_ERR, ("Failed to unmark (all lock) database %s\n",
241 int ctdb_lockall_unmark_prio(struct ctdb_context *ctdb, uint32_t priority)
244 * This function is only used by the main dameon during recovery.
245 * At this stage, the databases have already been locked, by a
246 * dedicated child process. The freeze_mode variable is used to track
247 * whether the actual locks are held by the child process or not.
250 if (ctdb->freeze_mode[priority] != CTDB_FREEZE_FROZEN) {
251 DEBUG(DEBUG_ERR, ("Attempt to unmark all databases locked when not frozen\n"));
255 return ctdb_db_iterator(ctdb, priority, db_lock_unmark_handler, NULL);
258 static int ctdb_lockall_unmark(struct ctdb_context *ctdb)
262 for (priority=NUM_DB_PRIORITIES; priority>=0; priority--) {
263 if (ctdb_db_iterator(ctdb, priority, db_lock_unmark_handler, NULL) != 0) {
272 static void ctdb_lock_schedule(struct ctdb_context *ctdb);
275 * Destructor to kill the child locking process
277 static int ctdb_lock_context_destructor(struct lock_context *lock_ctx)
279 if (lock_ctx->child > 0) {
280 ctdb_kill(lock_ctx->ctdb, lock_ctx->child, SIGKILL);
281 DLIST_REMOVE(lock_ctx->ctdb->lock_current, lock_ctx);
282 lock_ctx->ctdb->lock_num_current--;
283 CTDB_DECREMENT_STAT(lock_ctx->ctdb, locks.num_current);
284 if (lock_ctx->type == LOCK_RECORD || lock_ctx->type == LOCK_DB) {
285 CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_current);
288 DLIST_REMOVE(lock_ctx->ctdb->lock_pending, lock_ctx);
289 lock_ctx->ctdb->lock_num_pending--;
290 CTDB_DECREMENT_STAT(lock_ctx->ctdb, locks.num_pending);
291 if (lock_ctx->type == LOCK_RECORD || lock_ctx->type == LOCK_DB) {
292 CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_pending);
296 ctdb_lock_schedule(lock_ctx->ctdb);
303 * Destructor to remove lock request
305 static int ctdb_lock_request_destructor(struct lock_request *lock_request)
307 DLIST_REMOVE(lock_request->lctx->req_queue, lock_request);
312 void ctdb_lock_free_request_context(struct lock_request *lock_req)
314 struct lock_context *lock_ctx;
316 lock_ctx = lock_req->lctx;
317 talloc_free(lock_req);
318 talloc_free(lock_ctx);
323 * Process all the callbacks waiting for lock
325 * If lock has failed, callback is executed with locked=false
327 static void process_callbacks(struct lock_context *lock_ctx, bool locked)
329 struct lock_request *request, *next;
331 if (lock_ctx->auto_mark && locked) {
332 switch (lock_ctx->type) {
334 tdb_chainlock_mark(lock_ctx->ctdb_db->ltdb->tdb, lock_ctx->key);
338 tdb_lockall_mark(lock_ctx->ctdb_db->ltdb->tdb);
341 case LOCK_ALLDB_PRIO:
342 ctdb_lockall_mark_prio(lock_ctx->ctdb, lock_ctx->priority);
346 ctdb_lockall_mark(lock_ctx->ctdb);
351 /* Iterate through all callbacks */
352 request = lock_ctx->req_queue;
354 if (lock_ctx->auto_mark) {
355 /* Reset the destructor, so request is not removed from the list */
356 talloc_set_destructor(request, NULL);
359 /* In case, callback frees the request, store next */
360 next = request->next;
361 request->callback(request->private_data, locked);
365 if (lock_ctx->auto_mark && locked) {
366 switch (lock_ctx->type) {
368 tdb_chainlock_unmark(lock_ctx->ctdb_db->ltdb->tdb, lock_ctx->key);
372 tdb_lockall_unmark(lock_ctx->ctdb_db->ltdb->tdb);
375 case LOCK_ALLDB_PRIO:
376 ctdb_lockall_unmark_prio(lock_ctx->ctdb, lock_ctx->priority);
380 ctdb_lockall_unmark(lock_ctx->ctdb);
387 static int lock_bucket_id(double t)
389 double ms = 1.e-3, s = 1;
394 } else if (t < 10*ms) {
396 } else if (t < 100*ms) {
398 } else if (t < 1*s) {
400 } else if (t < 2*s) {
402 } else if (t < 4*s) {
404 } else if (t < 8*s) {
406 } else if (t < 16*s) {
408 } else if (t < 32*s) {
410 } else if (t < 64*s) {
420 * Callback routine when the required locks are obtained.
421 * Called from parent context
423 static void ctdb_lock_handler(struct tevent_context *ev,
424 struct tevent_fd *tfd,
428 struct lock_context *lock_ctx;
429 TALLOC_CTX *tmp_ctx = NULL;
435 lock_ctx = talloc_get_type_abort(private_data, struct lock_context);
437 /* cancel the timeout event */
438 if (lock_ctx->ttimer) {
439 TALLOC_FREE(lock_ctx->ttimer);
442 t = timeval_elapsed(&lock_ctx->start_time);
443 id = lock_bucket_id(t);
445 if (lock_ctx->auto_mark) {
446 tmp_ctx = talloc_new(ev);
447 talloc_steal(tmp_ctx, lock_ctx);
450 /* Read the status from the child process */
451 read(lock_ctx->fd[0], &c, 1);
452 locked = (c == 0 ? true : false);
454 /* Update statistics */
455 CTDB_DECREMENT_STAT(lock_ctx->ctdb, locks.num_pending);
456 CTDB_INCREMENT_STAT(lock_ctx->ctdb, locks.num_calls);
457 if (lock_ctx->ctdb_db) {
458 CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_pending);
459 CTDB_INCREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_calls);
463 if (lock_ctx->ctdb_db) {
464 CTDB_INCREMENT_STAT(lock_ctx->ctdb, locks.num_current);
465 CTDB_INCREMENT_STAT(lock_ctx->ctdb, locks.buckets[id]);
466 CTDB_UPDATE_LATENCY(lock_ctx->ctdb, lock_ctx->ctdb_db,
467 lock_type_str[lock_ctx->type], locks.latency,
468 lock_ctx->start_time);
470 CTDB_INCREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_current);
471 CTDB_UPDATE_DB_LATENCY(lock_ctx->ctdb_db, lock_type_str[lock_ctx->type], locks.latency, t);
472 CTDB_INCREMENT_DB_STAT(lock_ctx->ctdb_db, locks.buckets[id]);
475 CTDB_INCREMENT_STAT(lock_ctx->ctdb, locks.num_failed);
476 if (lock_ctx->ctdb_db) {
477 CTDB_INCREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_failed);
481 process_callbacks(lock_ctx, locked);
483 if (lock_ctx->auto_mark) {
484 talloc_free(tmp_ctx);
490 * Callback routine when required locks are not obtained within timeout
491 * Called from parent context
493 static void ctdb_lock_timeout_handler(struct tevent_context *ev,
494 struct tevent_timer *ttimer,
495 struct timeval current_time,
498 const char *cmd = getenv("CTDB_DEBUG_LOCKS");
499 struct lock_context *lock_ctx;
500 struct ctdb_context *ctdb;
503 lock_ctx = talloc_get_type_abort(private_data, struct lock_context);
504 ctdb = lock_ctx->ctdb;
506 if (lock_ctx->type == LOCK_RECORD || lock_ctx->type == LOCK_DB) {
508 ("Unable to get %s lock on database %s for %.0lf seconds\n",
509 (lock_ctx->type == LOCK_RECORD ? "RECORD" : "DB"),
510 lock_ctx->ctdb_db->db_name,
511 timeval_elapsed(&lock_ctx->start_time)));
514 ("Unable to get ALLDB locks for %.0lf seconds\n",
515 timeval_elapsed(&lock_ctx->start_time)));
518 /* fire a child process to find the blocking process */
522 execl(cmd, cmd, NULL);
526 /* reset the timeout timer */
527 // talloc_free(lock_ctx->ttimer);
528 lock_ctx->ttimer = tevent_add_timer(ctdb->ev,
530 timeval_current_ofs(10, 0),
531 ctdb_lock_timeout_handler,
536 static int db_count_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
539 int *count = (int *)private_data;
551 static int db_name_handler(struct ctdb_db_context *ctdb_db, uint32_t priority,
554 struct db_namelist *list = (struct db_namelist *)private_data;
556 list->names[list->n] = talloc_strdup(list->names, ctdb_db->db_path);
562 static char **lock_helper_args(TALLOC_CTX *mem_ctx, struct lock_context *lock_ctx, int fd)
564 struct ctdb_context *ctdb = lock_ctx->ctdb;
568 struct db_namelist list;
570 switch (lock_ctx->type) {
579 case LOCK_ALLDB_PRIO:
581 ctdb_db_iterator(ctdb, lock_ctx->priority, db_count_handler, &nargs);
586 for (priority=1; priority<NUM_DB_PRIORITIES; priority++) {
587 ctdb_db_iterator(ctdb, priority, db_count_handler, &nargs);
592 /* Add extra argument for null termination */
595 args = talloc_array(mem_ctx, char *, nargs);
600 args[0] = talloc_strdup(args, "ctdb_lock_helper");
601 args[1] = talloc_asprintf(args, "%d", getpid());
602 args[2] = talloc_asprintf(args, "%d", fd);
604 switch (lock_ctx->type) {
606 args[3] = talloc_strdup(args, "RECORD");
607 args[4] = talloc_strdup(args, lock_ctx->ctdb_db->db_path);
608 if (lock_ctx->key.dsize == 0) {
609 args[5] = talloc_strdup(args, "NULL");
611 args[5] = hex_encode_talloc(args, lock_ctx->key.dptr, lock_ctx->key.dsize);
616 args[3] = talloc_strdup(args, "DB");
617 args[4] = talloc_strdup(args, lock_ctx->ctdb_db->db_path);
620 case LOCK_ALLDB_PRIO:
621 args[3] = talloc_strdup(args, "DB");
624 ctdb_db_iterator(ctdb, lock_ctx->priority, db_name_handler, &list);
628 args[3] = talloc_strdup(args, "DB");
631 for (priority=1; priority<NUM_DB_PRIORITIES; priority++) {
632 ctdb_db_iterator(ctdb, priority, db_name_handler, &list);
637 /* Make sure last argument is NULL */
638 args[nargs-1] = NULL;
640 for (i=0; i<nargs-1; i++) {
641 if (args[i] == NULL) {
652 * Find the lock context of a given type
654 static struct lock_context *find_lock_context(struct lock_context *lock_list,
655 struct ctdb_db_context *ctdb_db,
660 struct lock_context *lock_ctx;
662 /* Search active locks */
663 for (lock_ctx=lock_list; lock_ctx; lock_ctx=lock_ctx->next) {
664 if (lock_ctx->type != type) {
668 switch (lock_ctx->type) {
670 if (ctdb_db == lock_ctx->ctdb_db &&
671 key.dsize == lock_ctx->key.dsize &&
672 memcmp(key.dptr, lock_ctx->key.dptr, key.dsize) == 0) {
678 if (ctdb_db == lock_ctx->ctdb_db) {
683 case LOCK_ALLDB_PRIO:
684 if (priority == lock_ctx->priority) {
695 /* Did not find the lock context we are searching for */
705 * Schedule a new lock child process
706 * Set up callback handler and timeout handler
708 static void ctdb_lock_schedule(struct ctdb_context *ctdb)
710 struct lock_context *lock_ctx, *next_ctx;
713 const char *helper = BINDIR "/ctdb_lock_helper";
714 static const char *prog = NULL;
720 t = getenv("CTDB_LOCK_HELPER");
722 prog = talloc_strdup(ctdb, t);
724 prog = talloc_strdup(ctdb, helper);
726 CTDB_NO_MEMORY_VOID(ctdb, prog);
729 if (ctdb->lock_num_current >= MAX_LOCK_PROCESSES_PER_DB) {
733 if (ctdb->lock_pending == NULL) {
737 /* Find a lock context with requests */
738 lock_ctx = ctdb->lock_pending;
739 while (lock_ctx != NULL) {
740 if (! lock_ctx->req_queue) {
741 next_ctx = lock_ctx->next;
742 DEBUG(DEBUG_INFO, ("Removing lock context without lock requests\n"));
743 DLIST_REMOVE(ctdb->lock_pending, lock_ctx);
744 ctdb->lock_num_pending--;
745 CTDB_DECREMENT_STAT(ctdb, locks.num_pending);
746 if (lock_ctx->ctdb_db) {
747 CTDB_DECREMENT_DB_STAT(lock_ctx->ctdb_db, locks.num_pending);
749 talloc_free(lock_ctx);
753 /* Found a lock context with lock requests */
758 if (lock_ctx == NULL) {
762 lock_ctx->child = -1;
763 ret = pipe(lock_ctx->fd);
765 DEBUG(DEBUG_ERR, ("Failed to create pipe in ctdb_lock_schedule\n"));
769 set_close_on_exec(lock_ctx->fd[0]);
771 /* Create data for child process */
772 tmp_ctx = talloc_new(lock_ctx);
773 if (tmp_ctx == NULL) {
774 DEBUG(DEBUG_ERR, ("Failed to allocate memory for helper args\n"));
775 close(lock_ctx->fd[0]);
776 close(lock_ctx->fd[1]);
780 /* Create arguments for lock helper */
781 args = lock_helper_args(tmp_ctx, lock_ctx, lock_ctx->fd[1]);
783 DEBUG(DEBUG_ERR, ("Failed to create lock helper args\n"));
784 close(lock_ctx->fd[0]);
785 close(lock_ctx->fd[1]);
786 talloc_free(tmp_ctx);
790 lock_ctx->child = ctdb_fork(ctdb);
792 if (lock_ctx->child == (pid_t)-1) {
793 DEBUG(DEBUG_ERR, ("Failed to create a child in ctdb_lock_schedule\n"));
794 close(lock_ctx->fd[0]);
795 close(lock_ctx->fd[1]);
796 talloc_free(tmp_ctx);
802 if (lock_ctx->child == 0) {
803 ret = execv(prog, args);
805 DEBUG(DEBUG_ERR, ("Failed to execute helper %s (%d, %s)\n",
806 prog, errno, strerror(errno)));
812 close(lock_ctx->fd[1]);
814 talloc_set_destructor(lock_ctx, ctdb_lock_context_destructor);
816 talloc_free(tmp_ctx);
818 /* Set up timeout handler */
819 lock_ctx->ttimer = tevent_add_timer(ctdb->ev,
821 timeval_current_ofs(10, 0),
822 ctdb_lock_timeout_handler,
824 if (lock_ctx->ttimer == NULL) {
825 ctdb_kill(ctdb, lock_ctx->child, SIGKILL);
826 lock_ctx->child = -1;
827 talloc_set_destructor(lock_ctx, NULL);
828 close(lock_ctx->fd[0]);
832 /* Set up callback */
833 lock_ctx->tfd = tevent_add_fd(ctdb->ev,
839 if (lock_ctx->tfd == NULL) {
840 TALLOC_FREE(lock_ctx->ttimer);
841 ctdb_kill(ctdb, lock_ctx->child, SIGKILL);
842 lock_ctx->child = -1;
843 talloc_set_destructor(lock_ctx, NULL);
844 close(lock_ctx->fd[0]);
847 tevent_fd_set_auto_close(lock_ctx->tfd);
849 /* Move the context from pending to current */
850 DLIST_REMOVE(ctdb->lock_pending, lock_ctx);
851 ctdb->lock_num_pending--;
852 DLIST_ADD_END(ctdb->lock_current, lock_ctx, NULL);
853 ctdb->lock_num_current++;
858 * Lock record / db depending on type
860 static struct lock_request *ctdb_lock_internal(struct ctdb_context *ctdb,
861 struct ctdb_db_context *ctdb_db,
864 void (*callback)(void *, bool),
869 struct lock_context *lock_ctx;
870 struct lock_request *request;
872 if (callback == NULL) {
873 DEBUG(DEBUG_WARNING, ("No callback function specified, not locking\n"));
877 /* get a context for this key - search only the pending contexts,
878 * current contexts might in the middle of processing callbacks */
879 lock_ctx = find_lock_context(ctdb->lock_pending, ctdb_db, key, priority, type);
881 /* No existing context, create one */
882 if (lock_ctx == NULL) {
883 lock_ctx = talloc_zero(ctdb, struct lock_context);
884 if (lock_ctx == NULL) {
885 DEBUG(DEBUG_ERR, ("Failed to create a new lock context\n"));
889 lock_ctx->type = type;
890 lock_ctx->ctdb = ctdb;
891 lock_ctx->ctdb_db = ctdb_db;
892 lock_ctx->key.dsize = key.dsize;
894 lock_ctx->key.dptr = talloc_memdup(lock_ctx, key.dptr, key.dsize);
896 lock_ctx->key.dptr = NULL;
898 lock_ctx->priority = priority;
899 lock_ctx->auto_mark = auto_mark;
901 lock_ctx->child = -1;
902 lock_ctx->block_child = -1;
904 DLIST_ADD_END(ctdb->lock_pending, lock_ctx, NULL);
905 ctdb->lock_num_pending++;
906 CTDB_INCREMENT_STAT(ctdb, locks.num_pending);
908 CTDB_INCREMENT_DB_STAT(ctdb_db, locks.num_pending);
911 /* Start the timer when we activate the context */
912 lock_ctx->start_time = timeval_current();
915 if ((request = talloc_zero(lock_ctx, struct lock_request)) == NULL) {
919 request->lctx = lock_ctx;
920 request->callback = callback;
921 request->private_data = private_data;
923 talloc_set_destructor(request, ctdb_lock_request_destructor);
924 DLIST_ADD_END(lock_ctx->req_queue, request, NULL);
926 ctdb_lock_schedule(ctdb);
933 * obtain a lock on a record in a database
935 struct lock_request *ctdb_lock_record(struct ctdb_db_context *ctdb_db,
938 void (*callback)(void *, bool),
941 return ctdb_lock_internal(ctdb_db->ctdb,
953 * obtain a lock on a database
955 struct lock_request *ctdb_lock_db(struct ctdb_db_context *ctdb_db,
957 void (*callback)(void *, bool),
960 return ctdb_lock_internal(ctdb_db->ctdb,
972 * obtain locks on all databases of specified priority
974 struct lock_request *ctdb_lock_alldb_prio(struct ctdb_context *ctdb,
977 void (*callback)(void *, bool),
980 if (priority < 0 || priority > NUM_DB_PRIORITIES) {
981 DEBUG(DEBUG_ERR, ("Invalid db priority: %u\n", priority));
985 return ctdb_lock_internal(ctdb,
997 * obtain locks on all databases
999 struct lock_request *ctdb_lock_alldb(struct ctdb_context *ctdb,
1001 void (*callback)(void *, bool),
1004 return ctdb_lock_internal(ctdb,