cls_has_chunk does not cover snapshotted manifest object.
This leads to unexpected behavior during chunk scrub.
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
}
}
+bool PrimaryLogPG::has_manifest_chunk(ObjectContextRef obc, std::string& fp_oid)
+{
+ // head
+ for (auto &p : obc->obs.oi.manifest.chunk_map) {
+ if (p.second.oid.oid.name == fp_oid) {
+ return true;
+ }
+ }
+ // snap
+ SnapSet& ss = obc->ssc->snapset;
+ for (vector<snapid_t>::const_iterator p = ss.clones.begin();
+ p != ss.clones.end();
+ ++p) {
+ hobject_t clone_oid = obc->obs.oi.soid;
+ clone_oid.snap = *p;
+ ObjectContextRef clone_obc = get_object_context(clone_oid, false);
+ if (clone_obc && clone_obc->obs.oi.has_manifest()) {
+ for (auto &p : clone_obc->obs.oi.manifest.chunk_map) {
+ if (p.second.oid.oid.name == fp_oid) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
ObjectContextRef PrimaryLogPG::get_prev_clone_obc(ObjectContextRef obc)
{
auto s = std::find(obc->ssc->snapset.clones.begin(), obc->ssc->snapset.clones.end(),
void maybe_kick_recovery(const hobject_t &soid);
void wait_for_unreadable_object(const hobject_t& oid, OpRequestRef op);
+ bool has_manifest_chunk(ObjectContextRef obc, std::string& fp_oid);
+
bool check_laggy(OpRequestRef& op);
bool check_laggy_requeue(OpRequestRef& op);
void recheck_readable() override;
bool cls_has_chunk(cls_method_context_t hctx, string fp_oid)
{
PrimaryLogPG::OpContext *ctx = *(PrimaryLogPG::OpContext **)hctx;
- if (!ctx->obc->obs.oi.has_manifest()) {
- return false;
- }
-
- for (auto &p : ctx->obc->obs.oi.manifest.chunk_map) {
- if (p.second.oid.oid.name == fp_oid) {
- return true;
- }
- }
-
- return false;
+ return ctx->pg->has_manifest_chunk(ctx->obc, fp_oid);
}
uint64_t cls_get_osd_min_alloc_size(cls_method_context_t hctx) {