]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: decrease refcount when object is deleted (has manifest) if the object is referenced
authormyoungwon oh <omwmw@sk.com>
Fri, 12 Jan 2018 11:19:57 +0000 (20:19 +0900)
committermyoungwon oh <omwmw@sk.com>
Fri, 13 Apr 2018 17:35:08 +0000 (02:35 +0900)
Signed-off-by: Myoungwon Oh <omwmw@sk.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index b7e9cb92098d64cfa5c227f07543efaa875f7537..b3b6314a7a9565d1d77201b42dd92b33c43e5c15 100644 (file)
@@ -51,7 +51,6 @@
 #include "json_spirit/json_spirit_reader.h"
 #include "include/assert.h"  // json_spirit clobbers it
 #include "include/rados/rados_types.hpp"
-#include "cls/refcount/cls_refcount_ops.h"
 
 #ifdef WITH_LTTNG
 #include "tracing/osd.h"
@@ -6565,6 +6564,27 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
       ++ctx->num_write;
       tracepoint(osd, do_osd_op_pre_delete, soid.oid.name.c_str(), soid.snap.val);
       {
+       if (oi.has_manifest()) {
+         if ((oi.flags & object_info_t::FLAG_REDIRECT_HAS_REFERENCE) && oi.manifest.is_redirect()) {
+           ctx->register_on_commit(
+             [oi, ctx, this](){
+             object_locator_t target_oloc(oi.manifest.redirect_target);
+             refcount_manifest(ctx->obc, target_oloc, oi.manifest.redirect_target, 
+                               SnapContext(), false, NULL, 0);
+           });
+         } else if (oi.manifest.is_chunked()) {
+           ctx->register_on_commit(
+             [oi, ctx, this](){
+             for (auto p : oi.manifest.chunk_map) {
+               if (p.second.flags & chunk_info_t::FLAG_HAS_REFERENCE) {
+                 object_locator_t target_oloc(p.second.oid);
+                 refcount_manifest(ctx->obc, target_oloc, p.second.oid, 
+                                   SnapContext(), false, NULL, p.first);
+               }
+             }
+           });
+         } 
+       } 
        result = _delete_oid(ctx, false, ctx->ignore_cache);
       }
       break;
index bb9ba8333f8ee71141f9c3e95e2aeab632bf2e79..48dbd070a921c68f4729164c7da257eb74510b75 100644 (file)
@@ -27,6 +27,7 @@
 #include "common/sharedptr_registry.hpp"
 #include "ReplicatedBackend.h"
 #include "PGTransaction.h"
+#include "cls/refcount/cls_refcount_ops.h"
 
 class CopyFromCallback;
 class PromoteCallback;
@@ -1406,7 +1407,7 @@ protected:
   void handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r,
                             uint64_t offset, uint64_t last_offset);
   void refcount_manifest(ObjectContextRef obc, object_locator_t oloc, hobject_t soid,
-                        SnapContext snapc, bool get, Context *cb, uint64_t offset);
+                         SnapContext snapc, bool get, Context *cb, uint64_t offset);
 
   friend struct C_ProxyChunkRead;
   friend class PromoteManifestCallback;