From dae43c7f1cc2b6f15577f38a83274515c9f090c0 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 4 Aug 2016 06:47:42 +0800 Subject: [PATCH] osd: add a comment for the purpose of pinned_maps For a better understanding since it can confuse newcommers. Signed-off-by: xie xingguo --- src/osd/OSD.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 616bb068beff3..830467bd7daaf 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 << " != " -- 2.39.5