]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: add epoch_t last_force_resend in Op/LingerOp. 4502/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 6 Mar 2015 03:26:31 +0000 (11:26 +0800)
committerLoic Dachary <ldachary@redhat.com>
Wed, 29 Apr 2015 18:16:13 +0000 (20:16 +0200)
Using this field record the pg_poo_t::last_force_op_resend to avoid op
endless when osd reply with redirect.

Fixes: #11026
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit def4fc4ae51174ae92ac1fb606427f4f6f00743e)

src/osdc/Objecter.cc
src/osdc/Objecter.h

index 05f8843577a7b4c2c0e32b83f490fe95e320f42d..6818febe7c0426e1bb0c1199ad177eb6519555de 100644 (file)
@@ -727,7 +727,7 @@ void Objecter::_linger_submit(LingerOp *info)
 
   // Populate Op::target
   OSDSession *s = NULL;
-  _calc_target(&info->target);
+  _calc_target(&info->target, &info->last_force_resend);
 
   // Create LingerOp<->OSDSession relation
   int r = _get_session(info->target.osd, &s, lc);
@@ -919,7 +919,7 @@ void Objecter::_scan_requests(OSDSession *s,
     Op *op = p->second;
     ++p;   // check_op_pool_dne() may touch ops; prevent iterator invalidation
     ldout(cct, 10) << " checking op " << op->tid << dendl;
-    int r = _calc_target(&op->target);
+    int r = _calc_target(&op->target, &op->last_force_resend);
     switch (r) {
     case RECALC_OP_TARGET_NO_ACTION:
       if (!force_resend &&
@@ -1135,7 +1135,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
        p != need_resend_linger.end(); ++p) {
     LingerOp *op = *p;
     if (!op->session) {
-      _calc_target(&op->target);
+      _calc_target(&op->target, &op->last_force_resend);
       OSDSession *s = NULL;
       int const r = _get_session(op->target.osd, &s, lc);
       assert(r == 0);
@@ -2092,7 +2092,7 @@ ceph_tid_t Objecter::_op_submit(Op *op, RWLock::Context& lc)
   assert(op->session == NULL);
   OSDSession *s = NULL;
 
-  bool const check_for_latest_map = _calc_target(&op->target) == RECALC_OP_TARGET_POOL_DNE;
+  bool const check_for_latest_map = _calc_target(&op->target, &op->last_force_resend) == RECALC_OP_TARGET_POOL_DNE;
 
   // Try to get a session, including a retry if we need to take write lock
   int r = _get_session(op->target.osd, &s, lc);
@@ -2370,7 +2370,7 @@ int64_t Objecter::get_object_pg_hash_position(int64_t pool, const string& key,
   return p->raw_hash_to_pg(p->hash_key(key, ns));
 }
 
-int Objecter::_calc_target(op_target_t *t, bool any_change)
+int Objecter::_calc_target(op_target_t *t, epoch_t *last_force_resend,  bool any_change)
 {
   assert(rwlock.is_locked());
 
@@ -2386,7 +2386,11 @@ int Objecter::_calc_target(op_target_t *t, bool any_change)
   bool force_resend = false;
   bool need_check_tiering = false;
   if (osdmap->get_epoch() == pi->last_force_op_resend) {
-    force_resend = true;
+    if (last_force_resend && *last_force_resend < pi->last_force_op_resend) {
+      *last_force_resend = pi->last_force_op_resend;
+      force_resend = true;
+    } else if (last_force_resend == 0)
+      force_resend = true;
   }
   if (t->target_oid.name.empty() || force_resend) {
     t->target_oid = t->base_oid;
@@ -2630,7 +2634,7 @@ int Objecter::_recalc_linger_op_target(LingerOp *linger_op, RWLock::Context& lc)
 {
   assert(rwlock.is_wlocked());
 
-  int r = _calc_target(&linger_op->target, true);
+  int r = _calc_target(&linger_op->target, &linger_op->last_force_resend, true);
   if (r == RECALC_OP_TARGET_NEED_RESEND) {
     ldout(cct, 10) << "recalc_linger_op_target tid " << linger_op->linger_id
                   << " pgid " << linger_op->target.pgid
index 68c429d58f37cd44c4d2ed686e50caab5f95bcf6..3466d4324fb920407af5b488fd66df5bb7a4f7de 100644 (file)
@@ -1193,6 +1193,8 @@ public:
 
     int *data_offset;
 
+    epoch_t last_force_resend;
+
     Op(const object_t& o, const object_locator_t& ol, vector<OSDOp>& op,
        int f, Context *ac, Context *co, version_t *ov, int *offset = NULL) :
       session(NULL), incarnation(0),
@@ -1214,7 +1216,8 @@ public:
       budgeted(false),
       should_resend(true),
       ctx_budgeted(false),
-      data_offset(offset) {
+      data_offset(offset),
+      last_force_resend(0) {
       ops.swap(op);
       
       /* initialize out_* to match op vector */
@@ -1549,6 +1552,8 @@ public:
     ceph_tid_t ping_tid;
     epoch_t map_dne_bound;
 
+    epoch_t last_force_resend;
+
     void _queued_async() {
       assert(watch_lock.is_locked());
       watch_pending_async.push_back(ceph_clock_now(NULL));
@@ -1576,7 +1581,8 @@ public:
                 session(NULL),
                 register_tid(0),
                 ping_tid(0),
-                map_dne_bound(0) {}
+                map_dne_bound(0),
+                last_force_resend(0) {}
 
     // no copy!
     const LingerOp &operator=(const LingerOp& r);
@@ -1731,7 +1737,7 @@ public:
   bool _osdmap_full_flag() const;
 
   bool target_should_be_paused(op_target_t *op);
-  int _calc_target(op_target_t *t, bool any_change=false);
+  int _calc_target(op_target_t *t, epoch_t *last_force_resend=0, bool any_change=false);
   int _map_session(op_target_t *op, OSDSession **s,
                   RWLock::Context& lc);