]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add a comment for the purpose of pinned_maps 10559/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 3 Aug 2016 22:47:42 +0000 (06:47 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 4 Aug 2016 02:33:49 +0000 (10:33 +0800)
For a better understanding since it can confuse newcommers.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc

index 616bb068beff3c3f606dd4c8009f21929df8be2f..830467bd7daafa2da8d97c118a1f08536ac7fcf8 100644 (file)
@@ -6633,6 +6633,12 @@ void OSD::trim_maps(epoch_t oldest, int nreceived, bool skip_maps)
 void OSD::handle_osd_map(MOSDMap *m)
 {
   assert(osd_lock.is_locked());
+  // Keep a ref in the list until we get the newly received map written
+  // onto disk. This is important because as long as the refs are alive,
+  // the OSDMaps will be pinned in the cache and we won't try to read it
+  // off of disk. Otherwise these maps will probably not stay in the cache,
+  // and reading those OSDMaps before they are actually written can result
+  // in a crash. 
   list<OSDMapRef> pinned_maps;
   if (m->fsid != monc->get_fsid()) {
     dout(0) << "handle_osd_map fsid " << m->fsid << " != "