diff options
author | Martin Schwenke <martin@meltin.net> | 2016-01-28 15:07:30 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2016-02-23 07:23:18 +0100 |
commit | 188019b877fb797e7da460028c5ec6f98f691877 (patch) | |
tree | 80028970581c92484a63b28342bce872091f41ed /ctdb/server/ctdb_recover.c | |
parent | fad3f367b77b120e2d0fc31cc2d87f46614dd266 (diff) | |
download | samba-188019b877fb797e7da460028c5ec6f98f691877.tar.gz |
ctdb-recovery: Negate the status when checking the recovery lock
Have 0 indicate that the lock was taken. This allows non-zero values
to be used to indicate why the lock could not be taken. EACCES means
lock contention.
For now use just EACCES to cover all failures, since
ctdb_recovery_lock() returns a bool and details of other errors will
be lost. ctdb_recovery_lock() will undergo some big changes, so don't
try to fix this now.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/server/ctdb_recover.c')
-rw-r--r-- | ctdb/server/ctdb_recover.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c index 658735bf977..988f205d1ef 100644 --- a/ctdb/server/ctdb_recover.c +++ b/ctdb/server/ctdb_recover.c @@ -477,12 +477,12 @@ static void set_recmode_handler(struct tevent_context *ev, ret = sys_read(state->fd[0], &c, 1); if (ret == 1) { - /* Child wrote status. 0 indicates that it was unable + /* Child wrote status. EACCES indicates that it was unable * to take the lock, which is the expected outcome. - * Non-zero indicates that it was able to take the + * 0 indicates that it was able to take the * lock, which is an error because the recovery daemon * should be holding the lock. */ - if (c == 0) { + if (c == EACCES) { status = 0; err = NULL; @@ -634,7 +634,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, } if (state->child == 0) { - char cc = 0; + char cc = EACCES; close(state->fd[0]); prctl_set_comment("ctdb_recmode"); @@ -646,7 +646,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, ("ERROR: Daemon able to take recovery lock on \"%s\" during recovery\n", ctdb->recovery_lock_file)); ctdb_recovery_unlock(ctdb); - cc = 1; + cc = 0; } sys_write(state->fd[1], &cc, 1); |