From: xie xingguo Date: Wed, 3 Aug 2016 22:47:42 +0000 (+0800) Subject: osd: add a comment for the purpose of pinned_maps X-Git-Tag: ses5-milestone5~181^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F10559%2Fhead;p=ceph.git osd: add a comment for the purpose of pinned_maps For a better understanding since it can confuse newcommers. Signed-off-by: xie xingguo --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 616bb068beff..830467bd7daa 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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 pinned_maps; if (m->fsid != monc->get_fsid()) { dout(0) << "handle_osd_map fsid " << m->fsid << " != "