From: Ruifeng Yang Date: Fri, 25 Sep 2015 04:42:28 +0000 (+0800) Subject: Objecter: repeated free op->ontimeout. X-Git-Tag: v9.1.0~61^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1d8a8f577cee6d66f4dcffac667675f18145ebb;p=ceph.git Objecter: repeated free op->ontimeout. repeated free op->ontimeout in SafeTimer::timer_thread::callback->complete Fixes: #13208 Signed-off-by: Ruifeng Yang --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 534241892b83..8c3547c8650f 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -1333,7 +1333,7 @@ void Objecter::_check_op_pool_dne(Op *op, bool session_locked) if (!session_locked) { s->lock.get_write(); } - _finish_op(op); + _finish_op(op, 0); if (!session_locked) { s->lock.unlock(); } @@ -2255,7 +2255,7 @@ int Objecter::op_cancel(OSDSession *s, ceph_tid_t tid, int r) op->oncommit_sync = NULL; } _op_cancel_map_check(op); - _finish_op(op); + _finish_op(op, r); s->lock.unlock(); return 0; @@ -2789,10 +2789,10 @@ void Objecter::_cancel_linger_op(Op *op) num_uncommitted.dec(); } - _finish_op(op); + _finish_op(op, 0); } -void Objecter::_finish_op(Op *op) +void Objecter::_finish_op(Op *op, int r) { ldout(cct, 15) << "finish_op " << op->tid << dendl; @@ -2801,7 +2801,7 @@ void Objecter::_finish_op(Op *op) if (!op->ctx_budgeted && op->budgeted) put_op_budget(op); - if (op->ontimeout) { + if (op->ontimeout && r != -ETIMEDOUT) { Mutex::Locker l(timer_lock); timer.cancel_event(op->ontimeout); } @@ -2830,7 +2830,7 @@ void Objecter::finish_op(OSDSession *session, ceph_tid_t tid) Op *op = iter->second; - _finish_op(op); + _finish_op(op, 0); } MOSDOp *Objecter::_prepare_osd_op(Op *op) @@ -3156,7 +3156,7 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m) // done with this tid? if (!op->onack && !op->oncommit && !op->oncommit_sync) { ldout(cct, 15) << "handle_osd_op_reply completed tid " << tid << dendl; - _finish_op(op); + _finish_op(op, 0); } ldout(cct, 5) << num_unacked.read() << " unacked, " << num_uncommitted.read() << " uncommitted" << dendl; @@ -3753,7 +3753,7 @@ void Objecter::handle_pool_op_reply(MPoolOpReply *m) } iter = pool_ops.find(tid); if (iter != pool_ops.end()) { - _finish_pool_op(op); + _finish_pool_op(op, 0); } } else { ldout(cct, 10) << "unknown request " << tid << dendl; @@ -3782,17 +3782,17 @@ int Objecter::pool_op_cancel(ceph_tid_t tid, int r) if (op->onfinish) op->onfinish->complete(r); - _finish_pool_op(op); + _finish_pool_op(op, r); return 0; } -void Objecter::_finish_pool_op(PoolOp *op) +void Objecter::_finish_pool_op(PoolOp *op, int r) { assert(rwlock.is_wlocked()); pool_ops.erase(op->tid); logger->set(l_osdc_poolop_active, pool_ops.size()); - if (op->ontimeout) { + if (op->ontimeout && r != -ETIMEDOUT) { Mutex::Locker l(timer_lock); timer.cancel_event(op->ontimeout); } @@ -3870,7 +3870,7 @@ void Objecter::handle_get_pool_stats_reply(MGetPoolStatsReply *m) last_seen_pgmap_version = m->version; } op->onfinish->complete(0); - _finish_pool_stat_op(op); + _finish_pool_stat_op(op, 0); } else { ldout(cct, 10) << "unknown request " << tid << dendl; } @@ -3895,18 +3895,18 @@ int Objecter::pool_stat_op_cancel(ceph_tid_t tid, int r) PoolStatOp *op = it->second; if (op->onfinish) op->onfinish->complete(r); - _finish_pool_stat_op(op); + _finish_pool_stat_op(op, r); return 0; } -void Objecter::_finish_pool_stat_op(PoolStatOp *op) +void Objecter::_finish_pool_stat_op(PoolStatOp *op, int r) { assert(rwlock.is_wlocked()); poolstat_ops.erase(op->tid); logger->set(l_osdc_poolstat_active, poolstat_ops.size()); - if (op->ontimeout) { + if (op->ontimeout && r != -ETIMEDOUT) { Mutex::Locker l(timer_lock); timer.cancel_event(op->ontimeout); } @@ -3977,7 +3977,7 @@ void Objecter::handle_fs_stats_reply(MStatfsReply *m) if (m->h.version > last_seen_pgmap_version) last_seen_pgmap_version = m->h.version; op->onfinish->complete(0); - _finish_statfs_op(op); + _finish_statfs_op(op, 0); } else { ldout(cct, 10) << "unknown request " << tid << dendl; } @@ -4002,18 +4002,18 @@ int Objecter::statfs_op_cancel(ceph_tid_t tid, int r) StatfsOp *op = it->second; if (op->onfinish) op->onfinish->complete(r); - _finish_statfs_op(op); + _finish_statfs_op(op, r); return 0; } -void Objecter::_finish_statfs_op(StatfsOp *op) +void Objecter::_finish_statfs_op(StatfsOp *op, int r) { assert(rwlock.is_wlocked()); statfs_ops.erase(op->tid); logger->set(l_osdc_statfs_active, statfs_ops.size()); - if (op->ontimeout) { + if (op->ontimeout && r != -ETIMEDOUT) { Mutex::Locker l(timer_lock); timer.cancel_event(op->ontimeout); } @@ -4579,7 +4579,7 @@ int Objecter::command_op_cancel(OSDSession *s, ceph_tid_t tid, int r) CommandOp *op = it->second; _command_cancel_map_check(op); - _finish_command(op, -ETIMEDOUT, ""); + _finish_command(op, r, ""); return 0; } @@ -4593,7 +4593,7 @@ void Objecter::_finish_command(CommandOp *c, int r, string rs) if (c->onfinish) c->onfinish->complete(r); - if (c->ontimeout) { + if (c->ontimeout && r != -ETIMEDOUT) { Mutex::Locker l(timer_lock); timer.cancel_event(c->ontimeout); } diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index d660c6352fe9..0dc67fcde25d 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1768,7 +1768,7 @@ public: void _send_op_account(Op *op); void _cancel_linger_op(Op *op); void finish_op(OSDSession *session, ceph_tid_t tid); - void _finish_op(Op *op); + void _finish_op(Op *op, int r); static bool is_pg_changed( int oldprimary, const vector& oldacting, @@ -2511,7 +2511,7 @@ public: private: void pool_op_submit(PoolOp *op); void _pool_op_submit(PoolOp *op); - void _finish_pool_op(PoolOp *op); + void _finish_pool_op(PoolOp *op, int r); void _do_delete_pool(int64_t pool, Context *onfinish); public: int create_pool_snap(int64_t pool, string& snapName, Context *onfinish); @@ -2537,7 +2537,7 @@ public: void get_pool_stats(list& pools, map *result, Context *onfinish); int pool_stat_op_cancel(ceph_tid_t tid, int r); - void _finish_pool_stat_op(PoolStatOp *op); + void _finish_pool_stat_op(PoolStatOp *op, int r); // --------------------------- // df stats @@ -2547,7 +2547,7 @@ public: void handle_fs_stats_reply(MStatfsReply *m); void get_fs_stats(struct ceph_statfs& result, Context *onfinish); int statfs_op_cancel(ceph_tid_t tid, int r); - void _finish_statfs_op(StatfsOp *op); + void _finish_statfs_op(StatfsOp *op, int r); // --------------------------- // some scatter/gather hackery