From: Greg Hudson Date: Thu, 30 Jan 2014 17:37:46 +0000 (-0500) Subject: Don't get KDB lock in ulog_get_entries X-Git-Tag: krb5-1.13-alpha1~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c3638e1cfafa6ec5595e6c2c06ca209cf9d0d09;p=thirdparty%2Fkrb5.git Don't get KDB lock in ulog_get_entries ulog_get_entries does not access the KDB, only the ulog, so it does not need a KDB lock; its read lock on the ulog is sufficient to prevent logged updates from happening while it is running. There is no reason to serialize against unlogged KDB updates such as those performed by the KDC, as those do not affect the ulog. --- diff --git a/src/lib/kdb/kdb_log.c b/src/lib/kdb/kdb_log.c index 1fd798e5f6..7e8514308b 100644 --- a/src/lib/kdb/kdb_log.c +++ b/src/lib/kdb/kdb_log.c @@ -576,17 +576,6 @@ ulog_get_entries(krb5_context context, const kdb_last_t *last, if (ulog->kdb_state != KDB_STABLE) reset_header(ulog); - /* - * We need to lock out other processes here, such as kadmin.local, since we - * are looking at the last_sno and looking up updates. So we can share - * with other readers. - */ - retval = krb5_db_lock(context, KRB5_LOCKMODE_SHARED); - if (retval) { - (void)ulog_lock(context, KRB5_LOCKMODE_UNLOCK); - return retval; - } - /* If we have the same sno and timestamp, return a nil update. If a * different timestamp, the sno was reused and we need a full resync. */ if (last->last_sno == ulog->kdb_last_sno) { @@ -652,7 +641,6 @@ ulog_get_entries(krb5_context context, const kdb_last_t *last, cleanup: (void)ulog_lock(context, KRB5_LOCKMODE_UNLOCK); - (void)krb5_db_unlock(context); return retval; }