]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: do not clone or preserve snapdir on cache_evict 2550/head
authorSage Weil <sage@redhat.com>
Sun, 21 Sep 2014 22:56:18 +0000 (15:56 -0700)
committerSage Weil <sage@redhat.com>
Sun, 21 Sep 2014 22:56:18 +0000 (15:56 -0700)
If we cache_evict a head in a cache pool, we need to prevent
make_writeable() from cloning the head and finish_ctx() from
preserving the snapdir object.

Fixes: #8629
Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 6d073755889ab3f98670ae57bc90ec5f5a6d7469..cd47f9f860f6d7d78fb6dd8c5b46ece66ddb4467 100644 (file)
@@ -3492,6 +3492,11 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
            break;
        }
        result = _delete_oid(ctx, true);
+       if (result >= 0) {
+         // mark that this is a cache eviction to avoid triggering normal
+         // make_writeable() clone or snapdir object creation in finish_ctx()
+         ctx->cache_evict = true;
+       }
        osd->logger->inc(l_osd_tier_evict);
       }
       break;
@@ -5054,6 +5059,7 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
   
   if ((ctx->obs->exists && !ctx->obs->oi.is_whiteout()) && // head exist(ed)
       snapc.snaps.size() &&                 // there are snaps
+      !ctx->cache_evict &&
       snapc.snaps[0] > ctx->new_snapset.seq) {  // existing object is old
     // clone
     hobject_t coid = soid;
@@ -5375,7 +5381,8 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
          ctx->snapset_obc->obs.exists = false;
        }
       }
-    } else if (ctx->new_snapset.clones.size()) {
+    } else if (ctx->new_snapset.clones.size() &&
+              !ctx->cache_evict) {
       // save snapset on _snap
       hobject_t snapoid(soid.oid, soid.get_key(), CEPH_SNAPDIR, soid.hash,
                        info.pgid.pool(), soid.get_namespace());
index 918e2d335f115dc3f815d431af2aa216ba5dfabe..57a84df1fecb83ef0f983c70936db61d67e5e12e 100644 (file)
@@ -438,6 +438,7 @@ public:
     bool modify;          // (force) modification (even if op_t is empty)
     bool user_modify;     // user-visible modification
     bool undirty;         // user explicitly un-dirtying this object
+    bool cache_evict;     ///< true if this is a cache eviction
 
     // side effects
     list<watch_info_t> watch_connects;
@@ -539,7 +540,7 @@ public:
              ReplicatedPG *_pg) :
       op(_op), reqid(_reqid), ops(_ops), obs(_obs), snapset(0),
       new_obs(_obs->oi, _obs->exists),
-      modify(false), user_modify(false), undirty(false),
+      modify(false), user_modify(false), undirty(false), cache_evict(false),
       bytes_written(0), bytes_read(0), user_at_version(0),
       current_osd_subop_num(0),
       op_t(NULL),