]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter: write a helper function to clean up ops that need to be retried
authorGreg Farnum <greg@inktank.com>
Tue, 3 Sep 2013 23:31:50 +0000 (16:31 -0700)
committerGreg Farnum <greg@inktank.com>
Tue, 10 Sep 2013 22:33:49 +0000 (15:33 -0700)
We have a little block to clean them up if we get back EAGAIN, but it's
actually leaking map references; we will also use this for redirects
from the OSDs.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 34a02c0fb44cef398d83068830c7bb69c0288735..f5ee22557d90fbed1648543d881339a57153afc9 100644 (file)
@@ -1548,6 +1548,15 @@ void Objecter::throttle_op(Op *op, int op_budget)
   }
 }
 
+void Objecter::unregister_op(Op *op)
+{
+  if (op->onack)
+    num_unacked--;
+  if (op->oncommit)
+    num_uncommitted--;
+  ops.erase(op->tid);
+}
+
 /* This function DOES put the passed message before returning */
 void Objecter::handle_osd_op_reply(MOSDOpReply *m)
 {
@@ -1596,10 +1605,7 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
 
   if (rc == -EAGAIN) {
     ldout(cct, 7) << " got -EAGAIN, resubmitting" << dendl;
-    if (op->onack)
-      num_unacked--;
-    if (op->oncommit)
-      num_uncommitted--;
+    unregister_op(op);
     op_submit(op);
     m->put();
     return;
index f1c41e5e3f99ec6ce83c06e3bb794e38e5b22473..58d52405a90cd644f1d989d8dc76e165aaf3f6a4 100644 (file)
@@ -1309,6 +1309,7 @@ private:
   // low-level
   tid_t op_submit(Op *op);
   tid_t _op_submit(Op *op);
+  inline void unregister_op(Op *op);
 
   // public interface
  public: