From e68109013d03829f2e9dc95586933212a0ea9ad7 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Thu, 12 Sep 2019 12:37:04 -0500 Subject: [PATCH] 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 Reviewed-by: Marcio Brito Barbosa Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/ubik/ubik.p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ubik/ubik.p.h b/src/ubik/ubik.p.h index 2c3371ff5e..66c03a8983 100644 --- a/src/ubik/ubik.p.h +++ b/src/ubik/ubik.p.h @@ -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