]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PG,OSD: clean up xlist::items on pg removal
authorSamuel Just <rexludorum@gmail.com>
Tue, 11 Oct 2011 15:33:32 +0000 (08:33 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Tue, 11 Oct 2011 18:39:07 +0000 (11:39 -0700)
Should take care of #1599.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/osd/OSD.cc
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc

index 53c38a50d472456660169991c9156c4b5cb625d5..780936ddf43bd7d4c2f2f3f724185009d6389d7a 100644 (file)
@@ -4664,11 +4664,11 @@ void OSD::_remove_pg(PG *pg)
   }
 
 
-  // remove_watchers_and_notifies and the erasure from the pg_map
-  // must be done together without unlocking the pg lock,
+  // on_removal, which calls remove_watchers_and_notifies, and the erasure from 
+  // the pg_map must be done together without unlocking the pg lock,
   // to avoid racing with watcher cleanup in ms_handle_reset
   // and handle_notify_timeout
-  pg->remove_watchers_and_notifies();
+  pg->on_removal();
 
   // remove from map
   pg_map.erase(pgid);
index 9cdcfe1cce4325c38532e99635274f8d551e1f80..2b9d1a7d93ac7e3e6356bbebffb6a3bda67940d1 100644 (file)
@@ -741,11 +741,13 @@ protected:
     bool _enqueue(PG *pg) {
       if (pg->snap_trim_item.is_on_list())
        return false;
+      pg->get();
       osd->snap_trim_queue.push_back(&pg->snap_trim_item);
       return true;
     }
     void _dequeue(PG *pg) {
-      pg->snap_trim_item.remove_myself();
+      if (pg->snap_trim_item.remove_myself())
+       pg->put();
     }
     PG *_dequeue() {
       if (osd->snap_trim_queue.empty())
index da09cb64948ab775946140f8469acdde11ec348d..b53860617034290ca41e61eab0e910fde2d12dda 100644 (file)
@@ -3540,6 +3540,20 @@ bool PG::old_peering_msg(epoch_t reply_epoch,
          last_peering_reset > query_epoch);
 }
 
+
+void PG::on_removal()
+{
+  osd->recovery_wq.dequeue(this);
+  osd->backlog_wq.dequeue(this);
+  osd->scrub_wq.dequeue(this);
+  osd->scrub_finalize_wq.dequeue(this);
+  osd->snap_trim_wq.dequeue(this);
+  osd->remove_wq.dequeue(this);
+  osd->pg_stat_queue_dequeue(this);
+
+  remove_watchers_and_notifies();
+}
+
 void PG::set_last_peering_reset() {
   last_peering_reset = osd->osdmap->get_epoch();
 }
index b346cda2eade95bab045bf26fd72637da9c51cca..f57145a1cf7f257e25354e4490d41d7738c71c85 100644 (file)
@@ -1645,7 +1645,7 @@ public:
     recovery_state.handle_loaded(rctx);
   }
 
-
+  void on_removal();
   // abstract bits
   virtual void do_op(MOSDOp *op) = 0;
   virtual void do_sub_op(MOSDSubOp *op) = 0;
index 57c7032580d808e69b23a1b3df9588e5aabb57a8..8df429ed6687cd074cce18795121899fd94e99ba 100644 (file)
@@ -990,6 +990,7 @@ bool ReplicatedPG::snap_trimmer()
       dout(10) << " can't write, requeueing" << dendl;
       queue_snap_trim();
       unlock();
+      put();
       return true;
     }
     if (!finalizing_scrub) {
@@ -1016,6 +1017,7 @@ bool ReplicatedPG::snap_trimmer()
     queue_snap_trim();
   }
   unlock();
+  put();
   return true;
 }