From c9ba42bd595347052d5b74b31bb83a3b2abc79d0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 7 May 2009 20:47:31 -0700 Subject: [PATCH] osd: make sure _finish_recovery only completes when it's supposed to Because the finish_recovery does a sync, the final cleanup is deferred, and we have to make sure we are still done (and we haven't, say, repeered or something). In this case, we thus make sure we don't clear out pg recovery_ops when we actually have ops in progress. --- src/osd/PG.cc | 11 ++++++++++- src/osd/PG.h | 1 + src/osd/ReplicatedPG.cc | 3 +-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 31214e6031b75..50fb5b4bbe9ac 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1469,6 +1469,8 @@ void PG::finish_recovery() log.reset_recovery_pointers(); + osd->finish_recovery_op(this, recovery_ops_active, true); + /* * sync all this before purging strays. but don't block! */ @@ -1498,7 +1500,6 @@ void PG::_finish_recovery(Context *c) dout(10) << "_finish_recovery -- stale" << dendl; } osd->map_lock.put_read(); - osd->finish_recovery_op(this, recovery_ops_active, true); unlock(); put(); } @@ -1508,6 +1509,14 @@ void PG::defer_recovery() osd->defer_recovery(this); } +void PG::_cancel_recovery() +{ + log.reset_recovery_pointers(); + finish_sync_event = 0; + + osd->finish_recovery_op(this, recovery_ops_active, true); +} + void PG::purge_strays() { diff --git a/src/osd/PG.h b/src/osd/PG.h index 1167ae2a32716..16ab76b7f436d 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -724,6 +724,7 @@ public: virtual void clean_up_local(ObjectStore::Transaction& t) = 0; + void _cancel_recovery(); virtual void cancel_recovery() = 0; virtual int start_recovery_ops(int max) = 0; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index c57a9c6b7e1cf..a42a7bb567edf 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2648,9 +2648,8 @@ void ReplicatedPG::cancel_recovery() osd->num_pulling -= pulling.size(); pulling.clear(); pushing.clear(); - log.reset_recovery_pointers(); - osd->finish_recovery_op(this, recovery_ops_active, true); + _cancel_recovery(); } int ReplicatedPG::start_recovery_ops(int max) -- 2.39.5