From 0724072b16478ff2106b206eaa29a286c75cb6db Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 Apr 2018 15:44:57 -0500 Subject: [PATCH] osd: clean up osdmap_lock Comment rules and take lock during init/shutdown (nice but not necessary). Signed-off-by: Sage Weil --- src/osd/OSD.cc | 2 ++ src/osd/OSD.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index fe25578967767..8b93650b46c8f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2524,6 +2524,7 @@ int OSD::init() // initialize osdmap references in sharded wq for (auto& shard : shards) { + Mutex::Locker l(shard->osdmap_lock); shard->shard_osdmap = osdmap; } @@ -3388,6 +3389,7 @@ int OSD::shutdown() osdmap = OSDMapRef(); for (auto s : shards) { + Mutex::Locker l(s->osdmap_lock); s->shard_osdmap = OSDMapRef(); } service.shutdown(); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 0caaa7514bc26..721fa5d59101a 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1113,7 +1113,7 @@ struct OSDShard { Cond sdata_cond; string osdmap_lock_name; - Mutex osdmap_lock; + Mutex osdmap_lock; ///< protect shard_osdmap updates vs users w/o shard_lock OSDMapRef shard_osdmap; OSDMapRef get_osdmap() { -- 2.39.5