From 7628474723489d9bb5ef97e35a2e102a8ae04d63 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 10 Jun 2019 17:31:08 -0500 Subject: [PATCH] osd/PrimaryLogPG: always remove the snap we are trimming This doesn't change behavior (yet), since we only trim snaps that are marked for removal in the OSDMap. Signed-off-by: Sage Weil --- src/osd/PrimaryLogPG.cc | 8 +++++--- src/osd/PrimaryLogPG.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index c145a1ec5df..198ed897d4f 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -4199,7 +4199,8 @@ void PrimaryLogPG::do_backfill_remove(OpRequestRef op) } int PrimaryLogPG::trim_object( - bool first, const hobject_t &coid, PrimaryLogPG::OpContextUPtr *ctxp) + bool first, const hobject_t &coid, snapid_t snap_to_trim, + PrimaryLogPG::OpContextUPtr *ctxp) { *ctxp = NULL; @@ -4247,7 +4248,8 @@ int PrimaryLogPG::trim_object( for (set::iterator i = old_snaps.begin(); i != old_snaps.end(); ++i) { - if (!osdmap->in_removed_snaps_queue(info.pgid.pgid.pool(), *i)) { + if (!osdmap->in_removed_snaps_queue(info.pgid.pgid.pool(), *i) && + *i != snap_to_trim) { new_snaps.insert(*i); } } @@ -15180,7 +15182,7 @@ boost::statechart::result PrimaryLogPG::AwaitAsyncWork::react(const DoSnapWork&) // Get next ldout(pg->cct, 10) << "AwaitAsyncWork react trimming " << object << dendl; OpContextUPtr ctx; - int error = pg->trim_object(in_flight.empty(), object, &ctx); + int error = pg->trim_object(in_flight.empty(), object, snap_to_trim, &ctx); if (error) { if (error == -ENOLCK) { ldout(pg->cct, 10) << "could not get write lock on obj " diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 7ed859780f1..0c1f9103277 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1496,7 +1496,8 @@ public: void handle_backoff(OpRequestRef& op); - int trim_object(bool first, const hobject_t &coid, OpContextUPtr *ctxp); + int trim_object(bool first, const hobject_t &coid, snapid_t snap_to_trim, + OpContextUPtr *ctxp); void snap_trimmer(epoch_t e) override; void kick_snap_trim() override; void snap_trimmer_scrub_complete() override; -- 2.39.5