diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-04-30 14:10:06 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-05-24 09:06:39 +1000 |
commit | c5c79d63f2e51f1e38dc48880d2cb02bbd5312be (patch) | |
tree | 2f5abc900147d4e1d5e9b11aea154e8946544695 /ctdb/server/ctdb_lock.c | |
parent | b96388f95fe30376628e38798ad03cdcf8d76668 (diff) | |
download | samba-c5c79d63f2e51f1e38dc48880d2cb02bbd5312be.tar.gz samba-c5c79d63f2e51f1e38dc48880d2cb02bbd5312be.tar.xz samba-c5c79d63f2e51f1e38dc48880d2cb02bbd5312be.zip |
locking: Use database iterator for unlocking databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 187ed83f9701c7fa8d3cc476d47c5d2a87d5c308)
Diffstat (limited to 'ctdb/server/ctdb_lock.c')
-rw-r--r-- | ctdb/server/ctdb_lock.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index 5b183fc0036..f6220e02033 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -222,22 +222,7 @@ static int db_unlock_handler(struct ctdb_db_context *ctdb_db, uint32_t priority, int ctdb_unlockall_prio(struct ctdb_context *ctdb, uint32_t priority) { - struct ctdb_db_context *ctdb_db; - - for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) { - if (ctdb_db->priority != priority) { - continue; - } - 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; + return ctdb_db_iterator(ctdb, priority, db_unlock_handler, NULL); } static int ctdb_unlockall(struct ctdb_context *ctdb) @@ -245,7 +230,7 @@ static int ctdb_unlockall(struct ctdb_context *ctdb) uint32_t priority; for (priority=NUM_DB_PRIORITIES; priority>=0; priority--) { - if (ctdb_unlockall_prio(ctdb, priority) != 0) { + if (ctdb_db_iterator(ctdb, priority, db_unlock_handler, NULL) != 0) { return -1; } } |