From: myoungwon oh Date: Fri, 12 Jan 2018 11:19:57 +0000 (+0900) Subject: osd: decrease refcount when object is deleted (has manifest) if the object is referenced X-Git-Tag: v13.1.0~257^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=19b5703f9f924b7620284494f1b131fe566d9399;p=ceph.git osd: decrease refcount when object is deleted (has manifest) if the object is referenced Signed-off-by: Myoungwon Oh --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b7e9cb92098d..b3b6314a7a95 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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& 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; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index bb9ba8333f8e..48dbd070a921 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -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;