]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: clean up osdmap_lock
authorSage Weil <sage@redhat.com>
Mon, 2 Apr 2018 20:44:57 +0000 (15:44 -0500)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:27:01 +0000 (08:27 -0500)
Comment rules and take lock during init/shutdown (nice but not necessary).

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index fe2557896776776d5dbe894207965781fb623efa..8b93650b46c8f0f84c77db6c1e11c49bec6ffecb 100644 (file)
@@ -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();
index 0caaa7514bc268ac40bc9c7ab32cddb05b7ac544..721fa5d59101a9abbc58fa84e09bd9cd5e70ccd5 100644 (file)
@@ -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() {