Skip to content

Commit

Permalink
Objecter::_op_submit_with_budget: add timeout before call
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit cfcfafc)
  • Loading branch information
athanatos authored and liewegas committed Mar 1, 2015
1 parent 283c2e7 commit 938e036
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/osdc/Objecter.cc
Expand Up @@ -1679,10 +1679,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)
Expand Down Expand Up @@ -1711,11 +1714,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);
}

Expand Down

0 comments on commit 938e036

Please sign in to comment.