]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: osd_lock assertions around pg_map access
authorSage Weil <sage@newdream.net>
Tue, 29 Jul 2008 13:49:21 +0000 (06:49 -0700)
committerSage Weil <sage@newdream.net>
Tue, 29 Jul 2008 13:49:21 +0000 (06:49 -0700)
src/osd/OSD.cc

index ecddd939b37eb3da376e28fec5fc2b6eec0c61b6..0474014c9fa0083b59f9dc5806fd6fc48656b900 100644 (file)
@@ -502,6 +502,8 @@ int OSD::read_superblock()
 
 PG *OSD::_open_lock_pg(pg_t pgid)
 {
+  assert(osd_lock.is_locked());
+
   // create
   PG *pg;
   if (pgid.is_rep())
@@ -522,6 +524,7 @@ PG *OSD::_open_lock_pg(pg_t pgid)
 
 PG *OSD::_create_lock_pg(pg_t pgid, ObjectStore::Transaction& t)
 {
+  assert(osd_lock.is_locked());
   dout(10) << "_create_lock_pg " << pgid << dendl;
 
   if (pg_map.count(pgid)) 
@@ -559,11 +562,13 @@ PG * OSD::_create_lock_new_pg(pg_t pgid, vector<int>& acting, ObjectStore::Trans
 
 bool OSD::_have_pg(pg_t pgid)
 {
+  assert(osd_lock.is_locked());
   return pg_map.count(pgid);
 }
 
 PG *OSD::_lookup_lock_pg(pg_t pgid)
 {
+  assert(osd_lock.is_locked());
   assert(pg_map.count(pgid));
   PG *pg = pg_map[pgid];
   pg->lock();
@@ -573,6 +578,7 @@ PG *OSD::_lookup_lock_pg(pg_t pgid)
 
 void OSD::_remove_unlock_pg(PG *pg) 
 {
+  assert(osd_lock.is_locked());
   pg_t pgid = pg->info.pgid;
 
   dout(10) << "_remove_unlock_pg " << pgid << dendl;
@@ -604,6 +610,7 @@ void OSD::_remove_unlock_pg(PG *pg)
 
 void OSD::load_pgs()
 {
+  assert(osd_lock.is_locked());
   dout(10) << "load_pgs" << dendl;
   assert(pg_map.empty());
 
@@ -732,6 +739,8 @@ void OSD::project_pg_history(pg_t pgid, PG::Info::History& h, epoch_t from,
  */
 void OSD::activate_pg(pg_t pgid, epoch_t epoch)
 {
+  assert(osd_lock.is_locked());
+
   if (pg_map.count(pgid)) {
     PG *pg = _lookup_lock_pg(pgid);
     if (pg->is_crashed() &&
@@ -852,6 +861,8 @@ void OSD::take_peer_stat(int peer, const osd_peer_stat_t& stat)
 
 void OSD::update_heartbeat_peers()
 {
+  assert(osd_lock.is_locked());
+
   // build heartbeat to/from set
   heartbeat_to.clear();
   heartbeat_from.clear();
@@ -1071,6 +1082,8 @@ void OSD::send_failures()
 
 void OSD::send_pg_stats()
 {
+  assert(osd_lock.is_locked());
+
   dout(10) << "send_pg_stats" << dendl;
 
   // grab queue
@@ -1393,6 +1406,7 @@ void OSD::note_up_osd(int osd)
 
 void OSD::handle_osd_map(MOSDMap *m)
 {
+  assert(osd_lock.is_locked());
   if (!ceph_fsid_equal(&m->fsid, &monmap->fsid)) {
     dout(0) << "handle_osd_map fsid " << m->fsid << " != " << monmap->fsid << dendl;
     delete m;
@@ -1596,6 +1610,8 @@ void OSD::handle_osd_map(MOSDMap *m)
  */
 void OSD::advance_map(ObjectStore::Transaction& t)
 {
+  assert(osd_lock.is_locked());
+
   dout(7) << "advance_map epoch " << osdmap->get_epoch() 
           << "  " << pg_map.size() << " pgs"
           << dendl;
@@ -1753,6 +1769,8 @@ void OSD::advance_map(ObjectStore::Transaction& t)
 
 void OSD::activate_map(ObjectStore::Transaction& t)
 {
+  assert(osd_lock.is_locked());
+
   dout(7) << "activate_map version " << osdmap->get_epoch() << dendl;
 
   map< int, list<PG::Info> >  notify_list;  // primary -> list
@@ -2508,6 +2526,8 @@ void OSD::handle_pg_info(MOSDPGInfo *m)
  */
 void OSD::handle_pg_query(MOSDPGQuery *m) 
 {
+  assert(osd_lock.is_locked());
+
   dout(7) << "handle_pg_query from " << m->get_source() << " epoch " << m->get_epoch() << dendl;
   int from = m->get_source().num();
   
@@ -2629,6 +2649,8 @@ void OSD::handle_pg_query(MOSDPGQuery *m)
 
 void OSD::handle_pg_remove(MOSDPGRemove *m)
 {
+  assert(osd_lock.is_locked());
+
   dout(7) << "handle_pg_remove from " << m->get_source() << dendl;
   
   if (!require_same_or_newer_map(m, m->get_epoch())) return;