krb5 commit: Don't get KDB lock in ulog_get_entries

Greg Hudson ghudson at MIT.EDU
Wed Feb 5 00:22:06 EST 2014


https://github.com/krb5/krb5/commit/3c3638e1cfafa6ec5595e6c2c06ca209cf9d0d09
commit 3c3638e1cfafa6ec5595e6c2c06ca209cf9d0d09
Author: Greg Hudson <ghudson at mit.edu>
Date:   Thu Jan 30 12:37:46 2014 -0500

    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.

 src/lib/kdb/kdb_log.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/src/lib/kdb/kdb_log.c b/src/lib/kdb/kdb_log.c
index 1fd798e..7e85143 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;
 }
 


More information about the cvs-krb5 mailing list