Skip to content

Commit

Permalink
osd: decrease refcount when object is deleted (has manifest) if the o…
Browse files Browse the repository at this point in the history
…bject is referenced

Signed-off-by: Myoungwon Oh <omwmw@sk.com>
  • Loading branch information
myoungwon committed Mar 6, 2018
1 parent 1a1c108 commit b372439
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/osd/PrimaryLogPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -6472,6 +6471,22 @@ 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()) {
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()) {
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;
Expand Down
3 changes: 2 additions & 1 deletion src/osd/PrimaryLogPG.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1406,7 +1407,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener {
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;
Expand Down

0 comments on commit b372439

Please sign in to comment.