Skip to content

Commit

Permalink
Check for unstable ulog in ulog_get_entries
Browse files Browse the repository at this point in the history
If a process terminates in the middle of a logged database update, it
will release its lock and leave the ulog in the KDB_UNSTABLE state.
kadmind should notice this when it calls ulog_get_entries, but right
now it only checks for the KDB_CORRUPT state (which is never set any
more) and does not recover.  Check for any state other than KDB_STABLE
and recover by resetting the ulog and forcing full resyncs to slaves.

(cherry picked from commit 91ef7d4)

ticket: 7853
version_fixed: 1.12.2
status: resolved
  • Loading branch information
greghudson authored and tlyu committed Jun 26, 2014
1 parent fb5b9d2 commit ac93fc8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib/kdb/kdb_log.c
Expand Up @@ -561,12 +561,10 @@ ulog_get_entries(krb5_context context, kdb_last_t last,
if (retval)
return retval;

/* Check to make sure we don't have a corrupt ulog first. */
if (ulog->kdb_state == KDB_CORRUPT) {
ulog_handle->ret = UPDATE_ERROR;
(void)ulog_lock(context, KRB5_LOCKMODE_UNLOCK);
return KRB5_LOG_CORRUPT;
}
/* If another process terminated mid-update, reset the ulog and force full
* resyncs. */
if (ulog->kdb_state != KDB_STABLE)
ulog_reset(ulog);

/*
* We need to lock out other processes here, such as kadmin.local, since we
Expand Down

0 comments on commit ac93fc8

Please sign in to comment.