]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: remove dead race handling code
authorJosh Durgin <jdurgin@redhat.com>
Tue, 10 Feb 2015 23:42:24 +0000 (15:42 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Tue, 10 Feb 2015 23:42:26 +0000 (15:42 -0800)
The only caller of _get_osd_session() holds rwlock for write, so
_get_session() cannot race. The only caller of _get_session() which
may possibly race is _op_submit(), which handles the race more simply
inline.

Call _get_session() inline in place of _get_osd_session(), and remove
the unused functions _get_osd_session() and
_promote_lock_check_race().

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index ee5c969ab3350ea63a3092214fc4d99721e304c1..edc1a1b50bd8f8b51808936e6b699fcbb8c0c63b 100644 (file)
@@ -2624,31 +2624,6 @@ void Objecter::_session_command_op_assign(OSDSession *to, CommandOp *op)
   ldout(cct, 15) << __func__ << " " << to->osd << " " << op->tid << dendl;
 }
 
-int Objecter::_get_osd_session(int osd, RWLock::Context& lc, OSDSession **psession)
-{
-  int r;
-  do {
-    r = _get_session(osd, psession, lc);
-    if (r == -EAGAIN) {
-      assert(!lc.is_wlocked());
-
-      if (!_promote_lock_check_race(lc)) {
-        return r;
-      }
-    }
-  } while (r == -EAGAIN);
-  assert(r == 0);
-
-  return 0;
-}
-
-bool Objecter::_promote_lock_check_race(RWLock::Context& lc)
-{
-  epoch_t epoch = osdmap->get_epoch();
-  lc.promote();
-  return (epoch == osdmap->get_epoch());
-}
-
 int Objecter::_recalc_linger_op_target(LingerOp *linger_op, RWLock::Context& lc)
 {
   assert(rwlock.is_wlocked());
@@ -2659,13 +2634,9 @@ int Objecter::_recalc_linger_op_target(LingerOp *linger_op, RWLock::Context& lc)
                   << " pgid " << linger_op->target.pgid
                   << " acting " << linger_op->target.acting << dendl;
     
-    OSDSession *s;
-    r = _get_osd_session(linger_op->target.osd, lc, &s);
-    if (r < 0) {
-      // We have no session for the new destination for the op, so leave it
-      // in this session to be handled again next time we scan requests
-      return r;
-    }
+    OSDSession *s = NULL;
+    r = _get_session(linger_op->target.osd, &s, lc);
+    assert(r == 0);
 
     if (linger_op->session != s) {
       // NB locking two sessions (s and linger_op->session) at the same time here
index a447c3e365eb23a60eeb2d05c1dc5069e34d0549..3c033f351a9df2bc4672e8a5a98a43b27cae6447 100644 (file)
@@ -1741,7 +1741,6 @@ public:
   void _session_command_op_assign(OSDSession *to, CommandOp *op);
   void _session_command_op_remove(OSDSession *from, CommandOp *op);
 
-  int _get_osd_session(int osd, RWLock::Context& lc, OSDSession **psession);
   int _assign_op_target_session(Op *op, RWLock::Context& lc, bool src_session_locked, bool dst_session_locked);
   int _recalc_linger_op_target(LingerOp *op, RWLock::Context& lc);
 
@@ -1929,7 +1928,6 @@ private:
   int pool_snap_get_info(int64_t poolid, snapid_t snap, pool_snap_info_t *info);
   int pool_snap_list(int64_t poolid, vector<uint64_t> *snaps);
 private:
-  bool _promote_lock_check_race(RWLock::Context& lc);
 
   // low-level
   ceph_tid_t _op_submit(Op *op, RWLock::Context& lc);