]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter::_op_submit_with_budget: add timeout before call 3620/head 3622/head
authorSamuel Just <sjust@redhat.com>
Mon, 2 Feb 2015 21:57:00 +0000 (13:57 -0800)
committerSamuel Just <sjust@redhat.com>
Mon, 2 Feb 2015 22:08:37 +0000 (14:08 -0800)
Objecter::_send_op depends on the ontimeout field being filled in
to avoid 10340 and 9582.

Fixes: 10340
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osdc/Objecter.cc

index c79ca39b26745589f8b2554cd4eed21ba5e047ab..20f89767226bf437c6ba360663d637603388cdbc 100644 (file)
@@ -1970,10 +1970,13 @@ class C_CancelOp : public Context
   ceph_tid_t tid;
   Objecter *objecter;
 public:
-  C_CancelOp(ceph_tid_t t, Objecter *objecter) : tid(t), objecter(objecter) {}
+  C_CancelOp(Objecter *objecter) : objecter(objecter) {}
   void finish(int r) {
     objecter->op_cancel(tid, -ETIMEDOUT);
   }
+  void set_tid(ceph_tid_t _tid) {
+    tid = _tid;
+  }
 };
 
 ceph_tid_t Objecter::op_submit(Op *op, int *ctx_budget)
@@ -2002,11 +2005,17 @@ ceph_tid_t Objecter::_op_submit_with_budget(Op *op, RWLock::Context& lc, int *ct
     }
   }
 
+  C_CancelOp *cb = NULL;
+  if (osd_timeout > 0) {
+    cb = new C_CancelOp(this);
+    op->ontimeout = cb;
+  }
+
   ceph_tid_t tid = _op_submit(op, lc);
 
-  if (osd_timeout > 0) {
+  if (cb) {
+    cb->set_tid(tid);
     Mutex::Locker l(timer_lock);
-    op->ontimeout = new C_CancelOp(tid, this);
     timer.add_event_after(osd_timeout, op->ontimeout);
   }