]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::make_writeable: check for evicted clone before adjusting for clone_overlap
authorSamuel Just <sam.just@inktank.com>
Sun, 6 Apr 2014 23:30:25 +0000 (16:30 -0700)
committerSamuel Just <sam.just@inktank.com>
Mon, 7 Apr 2014 21:33:56 +0000 (14:33 -0700)
Fixes: #7964
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index dc5123b74de7bd51631eb8d87d81b5c59b66ab76..724b5394cecc5423e89fcfa2f4489c731c0e640f 100644 (file)
@@ -4777,11 +4777,17 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
 
   // update most recent clone_overlap and usage stats
   if (ctx->new_snapset.clones.size() > 0) {
-    interval_set<uint64_t> &newest_overlap = ctx->new_snapset.clone_overlap.rbegin()->second;
-    ctx->modified_ranges.intersection_of(newest_overlap);
-    // modified_ranges is still in use by the clone
-    add_interval_usage(ctx->modified_ranges, ctx->delta_stats);
-    newest_overlap.subtract(ctx->modified_ranges);
+    /* we need to check whether the most recent clone exists, if it's been evicted,
+     * it's not included in the stats */
+    hobject_t last_clone_oid = soid;
+    last_clone_oid.snap = ctx->new_snapset.clone_overlap.rbegin()->first;
+    if (is_present_clone(last_clone_oid)) {
+      interval_set<uint64_t> &newest_overlap = ctx->new_snapset.clone_overlap.rbegin()->second;
+      ctx->modified_ranges.intersection_of(newest_overlap);
+      // modified_ranges is still in use by the clone
+      add_interval_usage(ctx->modified_ranges, ctx->delta_stats);
+      newest_overlap.subtract(ctx->modified_ranges);
+    }
   }
   
   // prepend transaction to op_t
@@ -6185,6 +6191,16 @@ void ReplicatedPG::cancel_flush_ops(bool requeue)
   }
 }
 
+bool ReplicatedPG::is_present_clone(hobject_t coid)
+{
+  if (pool.info.cache_mode == pg_pool_t::CACHEMODE_NONE)
+    return true;
+  if (is_missing_object(coid))
+    return true;
+  ObjectContextRef obc = get_object_context(coid, false);
+  return obc && obc->obs.exists;
+}
+
 // ========================================================================
 // rep op gather
 
index 915151cfc2f654cd082c4bf10f6277275f49d91d..895fe6fa4bff9d112259aab2a6b07172a13e2e31 100644 (file)
@@ -1190,6 +1190,9 @@ protected:
   void cancel_flush(FlushOpRef fop, bool requeue);
   void cancel_flush_ops(bool requeue);
 
+  /// @return false if clone is has been evicted
+  bool is_present_clone(hobject_t coid);
+
   friend struct C_Flush;
 
   // -- scrub --