Commit
e4ac552a (ubik: Introduce version lock) added UBIK_VERSION_LOCK
and version_data. The commit message mentions that holding either
UBIK_VERSION_LOCK or DBHOLD is enough to be able to read the protected
items and both locks must be held to modify them, but this isn't
mentioned in the actual code.
Add a comment explaining these locking rules, to make these rules
clearer to readers.
Change-Id: I715f89695add6d94e13d6ee1dc6addd1e748d3fd
Reviewed-on: https://gerrit.openafs.org/13863
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
/*!
* \brief The version lock protects the structure member, as well as
- * the database version, flags, tidCounter, writeTidCounter
+ * the database version, flags, tidCounter, writeTidCounter. Reading these
+ * values can be done while holding either UBIK_VERSION_LOCK or DBHOLD. Writing
+ * these requires holding both locks.
*/
struct version_data {
#ifdef AFS_PTHREAD_ENV