]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: do not clone or preserve snapdir on cache_evict 2737/head
authorSage Weil <sage@redhat.com>
Sun, 21 Sep 2014 22:56:18 +0000 (15:56 -0700)
committerSage Weil <sage@redhat.com>
Fri, 17 Oct 2014 01:27:37 +0000 (18:27 -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>
(cherry picked from commit ce8eefca13008a9cce3aedd67b11537145e1fd77)

src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index d23e6fc9292ac0cb2b07d3df2694af3db97762c3..7f16ad47f745e1b7ddf0055153165b33c6817ecd 100644 (file)
@@ -3353,6 +3353,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;
@@ -4836,6 +4841,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;
@@ -5156,7 +5162,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 9ef131c189f5c73cc974b4df73c825ed4f393110..9a61c003ec14827239b600206cb2146628d420d8 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),