Protect ubik cache accesses
authorAndrew Deason <adeason@sinenomine.net>
Wed, 31 Mar 2010 16:40:42 +0000 (11:40 -0500)
committerRuss Allbery <rra@stanford.edu>
Wed, 26 May 2010 22:00:51 +0000 (15:00 -0700)
commitdc8f18d6f5003712bc9ef989363137a84953df07
tree34dde835673b93a09007e36e42929fbe3f8c7046
parent5698becffffb49ff49f69ce202032ae0bd9e9f7a
Protect ubik cache accesses

Currently, ubik application cached data could be updated and read by
different threads simultaneously. Add a mechanism in ubik for
protecting accessing and updating the cached data. This adds the
function ubik_CheckCache to do this, and removes ubik_CacheUpdate as
an exported function (since it's not safe).

Update all callers to use the new mechanism. In ptserver, remove the
'initd' variable; just rely on cachedVersion and ubik_CheckCache to
tell us when to re-read the database. Remove db.lock in buserver and
cheader_lock in kaserver, which served similar (though not completely
threadsafe) protection as ubik_CheckCache. Add the ubik database lock
cache_lock to protect the application cache.

Change-Id: I857a67d410e2c539197c5212c3b114c3fd0403c2
Reviewed-on: http://gerrit.openafs.org/1546
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Russ Allbery <rra@stanford.edu>
src/budb/database.c
src/kauth/kadatabase.c
src/ptserver/ptprocs.c
src/ptserver/ptutils.c
src/ptserver/ubik.c
src/ubik/ubik.c
src/ubik/ubik.p.h
src/vlserver/vlutils.c