]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: disable lockdep for double lock
authorJohn Spray <john.spray@redhat.com>
Fri, 22 Aug 2014 12:37:46 +0000 (13:37 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:19 +0000 (01:34 +0100)
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 <john.spray@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index c3fdb6528d43c39705bf7130729ddfe368ab6cf5..bfb786761955d584fe415e3bb10f4a10347ec553 100644 (file)
@@ -619,6 +619,7 @@ void Objecter::_scan_requests(OSDSession *s,
   map<ceph_tid_t,LingerOp*>::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();
index fbeeb1a8dd4b558e5e18a4c36cea8954cd1ea408..752c55b366d56f53da31f24a9211b82d1401d854 100644 (file)
@@ -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++) {