From f4d8d16fbbb0a69c3bd8756e4096608294fccf9a Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 24 Feb 2015 18:49:26 -0800 Subject: [PATCH] librbd: clarify md_lock usage Signed-off-by: Josh Durgin --- src/librbd/ImageCtx.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index cb1d64d737bb4..deca81d11b7b0 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -75,8 +75,14 @@ namespace librbd { */ RWLock owner_lock; // protects exclusive lock leadership updates RWLock md_lock; // protects access to the mutable image metadata that - // isn't guarded by other locks below - // (flush_encountered, etc) + // isn't guarded by other locks below, and blocks writes + // when held exclusively, so snapshots can be consistent. + // Fields guarded include: + // flush_encountered + // total_bytes_read + // exclusive_locked + // lock_tag + // lockers Mutex cache_lock; // used as client_lock for the ObjectCacher RWLock snap_lock; // protects snapshot-related member variables, features, and flags RWLock parent_lock; // protects parent_md and parent -- 2.39.5