mirror of
https://github.com/ceph/ceph
synced 2025-02-22 10:37:15 +00:00
Merge pull request #3622 from athanatos/wip-10340
Objecter::_op_submit_with_budget: add timeout before call Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
7dc9adeec3
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user