summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-01-26 17:23:53 -0500
committerGreg Hudson <ghudson@mit.edu>2014-01-30 18:33:10 -0500
commit91ef7d4c3f892b99630422a71780788f2d1c04d7 (patch)
tree3a8818af0b5cea63f4e70ceafe81bbf713da3486
parentb8a0c995d2a72cbfd2500de89e395e1ee10fc8e0 (diff)
downloadkrb5-91ef7d4c3f892b99630422a71780788f2d1c04d7.zip
krb5-91ef7d4c3f892b99630422a71780788f2d1c04d7.tar.gz
krb5-91ef7d4c3f892b99630422a71780788f2d1c04d7.tar.xz
Check for unstable ulog in ulog_get_entries
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. ticket: 7853 (new) target_version: 1.12.2 tags: pullup
-rw-r--r--src/lib/kdb/kdb_log.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/kdb/kdb_log.c b/src/lib/kdb/kdb_log.c
index 21cb09d..71f0a33 100644
--- a/src/lib/kdb/kdb_log.c
+++ b/src/lib/kdb/kdb_log.c
@@ -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