From: John Spray Date: Fri, 22 Aug 2014 12:37:46 +0000 (+0100) Subject: osdc/Objecter: disable lockdep for double lock X-Git-Tag: v0.86~213^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2463be5b7d396746123404d443281c3ed2563eb4;p=ceph.git osdc/Objecter: disable lockdep for double lock There is a special case in _recalc_linger_op_target where we lock two sessions at once to transfer an op between them. It is deadlock safe because it's the only place we lock two at once, and we hold rwlock for write while we do it. Signed-off-by: John Spray --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index c3fdb6528d43..bfb786761955 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -619,6 +619,7 @@ void Objecter::_scan_requests(OSDSession *s, map::iterator lp = s->linger_ops.begin(); while (lp != s->linger_ops.end()) { LingerOp *op = lp->second; + assert(op->session == s); ++lp; // check_linger_pool_dne() may touch linger_ops; prevent iterator invalidation ldout(cct, 10) << " checking linger op " << op->linger_id << dendl; bool unregister; @@ -2226,11 +2227,11 @@ int Objecter::_recalc_linger_op_target(LingerOp *linger_op, RWLock::Context& lc) if (linger_op->session != s) { // NB locking two sessions (s and linger_op->session) at the same time here // is only safe because we are the only one that takes two, and we are - // holding rwlock for write. - s->lock.get_write(); + // holding rwlock for write. Disable lockdep because it doesn't know that. + s->lock.get_write(false); _session_linger_op_remove(linger_op->session, linger_op); _session_linger_op_assign(s, linger_op); - s->lock.unlock(); + s->lock.unlock(false); } put_session(s); @@ -3874,8 +3875,6 @@ Objecter::~Objecter() { delete osdmap; - - assert(homeless_session->get_nref() == 1); assert(num_homeless_ops.read() == 0); homeless_session->put(); diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index fbeeb1a8dd4b..752c55b366d5 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1450,7 +1450,12 @@ public: int num_locks; ConnectionRef con; - OSDSession(CephContext *cct, int o) : lock("OSDSession"), osd(o), incarnation(0), con(NULL) { + OSDSession(CephContext *cct, int o) : + lock("OSDSession"), + osd(o), + incarnation(0), + con(NULL) + { num_locks = cct->_conf->objecter_completion_locks_per_session; completion_locks = new Mutex *[num_locks]; for (int i = 0; i < num_locks; i++) {