From ba210653b51ac96202507309ec2e9d4077ff6d7f Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Wed, 6 Mar 2019 14:11:16 +0800 Subject: [PATCH] osd/PrimaryLogPG: fix last_peering_reset checking on manifest flushing ```handle_manifest_flush``` is obviously using the wrong **last_peering_reset** to check whether a new peering procedure has been re-initialized by then. Fix by using a different alias of the local copy of the pg-wide **last_peering_reset** variable, which is less confusing and error-prone. Signed-off-by: xie xingguo --- src/osd/PrimaryLogPG.cc | 13 +++++++------ src/osd/PrimaryLogPG.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index b588cba9cc85d..51713b294145c 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -2546,27 +2546,28 @@ PrimaryLogPG::cache_result_t PrimaryLogPG::maybe_handle_manifest_detail( struct C_ManifestFlush : public Context { PrimaryLogPGRef pg; hobject_t oid; - epoch_t last_peering_reset; + epoch_t lpr; ceph_tid_t tid; utime_t start; uint64_t offset; uint64_t last_offset; - C_ManifestFlush(PrimaryLogPG *p, hobject_t o, epoch_t lpr) - : pg(p), oid(o), last_peering_reset(lpr), + C_ManifestFlush(PrimaryLogPG *p, hobject_t o, epoch_t e) + : pg(p), oid(o), lpr(e), tid(0), start(ceph_clock_now()) {} void finish(int r) override { if (r == -ECANCELED) return; pg->lock(); - pg->handle_manifest_flush(oid, tid, r, offset, last_offset); + pg->handle_manifest_flush(oid, tid, r, offset, last_offset, lpr); pg->osd->logger->tinc(l_osd_tier_flush_lat, ceph_clock_now() - start); pg->unlock(); } }; void PrimaryLogPG::handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r, - uint64_t offset, uint64_t last_offset) + uint64_t offset, uint64_t last_offset, + epoch_t lpr) { map::iterator p = flush_ops.find(oid); if (p == flush_ops.end()) { @@ -2585,7 +2586,7 @@ void PrimaryLogPG::handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r, } } if (p->second->chunks == p->second->io_results.size()) { - if (last_peering_reset == get_last_peering_reset()) { + if (lpr == get_last_peering_reset()) { ceph_assert(p->second->obc); finish_manifest_flush(oid, tid, r, p->second->obc, last_offset); } diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 958a657378e16..1fdc11d4b11e6 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1427,7 +1427,7 @@ protected: void finish_manifest_flush(hobject_t oid, ceph_tid_t tid, int r, ObjectContextRef obc, uint64_t last_offset); void handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r, - uint64_t offset, uint64_t last_offset); + uint64_t offset, uint64_t last_offset, epoch_t lpr); void refcount_manifest(ObjectContextRef obc, object_locator_t oloc, hobject_t soid, SnapContext snapc, bool get, Context *cb, uint64_t offset); -- 2.39.5