diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-07-01 16:28:04 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-07-02 12:59:08 +1000 |
commit | 622ccd09f9812e965d4e3be33daad2176c0ff9aa (patch) | |
tree | ed80bcab2b208592d84f648dcef92cedc262d04f /ctdb/server/ctdb_freeze.c | |
parent | cf17247d312a2d5a6cb191c2db7e50bd3bf5bd6f (diff) | |
download | samba-622ccd09f9812e965d4e3be33daad2176c0ff9aa.tar.gz samba-622ccd09f9812e965d4e3be33daad2176c0ff9aa.tar.xz samba-622ccd09f9812e965d4e3be33daad2176c0ff9aa.zip |
freeze: Make ctdb_start_freeze() a void function
If this function fails due to memory errors, there is no way to recover.
The best course of action is to abort.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 46efe7a886f8c4c56f19536adc98a73c22db906a)
Diffstat (limited to 'ctdb/server/ctdb_freeze.c')
-rw-r--r-- | ctdb/server/ctdb_freeze.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/ctdb/server/ctdb_freeze.c b/ctdb/server/ctdb_freeze.c index 1acd5c7fa71..fee44d4646c 100644 --- a/ctdb/server/ctdb_freeze.c +++ b/ctdb/server/ctdb_freeze.c @@ -126,7 +126,7 @@ static int ctdb_freeze_waiter_destructor(struct ctdb_freeze_waiter *w) /* start the freeze process for a certain priority */ -int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority) +void ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority) { struct ctdb_freeze_handle *h; @@ -137,7 +137,7 @@ int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority) if (ctdb->freeze_mode[priority] == CTDB_FREEZE_FROZEN) { /* we're already frozen */ - return 0; + return; } DEBUG(DEBUG_ERR, ("Freeze priority %u\n", priority)); @@ -148,18 +148,16 @@ int ctdb_start_freeze(struct ctdb_context *ctdb, uint32_t priority) /* if there isn't a freeze lock child then create one */ if (ctdb->freeze_handles[priority] == NULL) { h = talloc_zero(ctdb, struct ctdb_freeze_handle); - CTDB_NO_MEMORY(ctdb, h); + CTDB_NO_MEMORY_FATAL(ctdb, h); h->ctdb = ctdb; h->priority = priority; talloc_set_destructor(h, ctdb_freeze_handle_destructor); h->lreq = ctdb_lock_alldb_prio(ctdb, priority, false, ctdb_freeze_lock_handler, h); - CTDB_NO_MEMORY(ctdb, h->lreq); + CTDB_NO_MEMORY_FATAL(ctdb, h->lreq); ctdb->freeze_handles[priority] = h; ctdb->freeze_mode[priority] = CTDB_FREEZE_PENDING; } - - return 0; } /* @@ -188,10 +186,7 @@ int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control * return 0; } - if (ctdb_start_freeze(ctdb, priority) != 0) { - DEBUG(DEBUG_ERR,(__location__ " Failed to start freezing databases with priority %u\n", priority)); - return -1; - } + ctdb_start_freeze(ctdb, priority); /* add ourselves to list of waiters */ if (ctdb->freeze_handles[priority] == NULL) { @@ -222,10 +217,7 @@ bool ctdb_blocking_freeze(struct ctdb_context *ctdb) int i; for (i=1; i<=NUM_DB_PRIORITIES; i++) { - if (ctdb_start_freeze(ctdb, i)) { - DEBUG(DEBUG_ERR,(__location__ " Failed to freeze databases of prio %u\n", i)); - continue; - } + ctdb_start_freeze(ctdb, i); /* block until frozen */ while (ctdb->freeze_mode[i] == CTDB_FREEZE_PENDING) { |