ubik: Clarify UBIK_VERSION_LOCK semantics

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>
This commit is contained in:
Andrew Deason 2019-09-12 12:37:04 -05:00 committed by Benjamin Kaduk
parent 086d185872
commit e68109013d

View File

@ -417,7 +417,9 @@ struct addr_data {
/*!
* \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