From 49e54aba3316270883dcbc6b9530518217d9b601 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 3 Mar 2014 11:35:28 -0800 Subject: [PATCH] mon/OSDMonitor: fix race in 'osd tier remove ...' Signed-off-by: Sage Weil --- src/mon/OSDMonitor.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ff2fef11903ad..7ad68c4ee15e7 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -4555,8 +4555,16 @@ done: goto reply; } // go - pending_inc.get_new_pool(pool_id, p)->tiers.erase(tierpool_id); - pending_inc.get_new_pool(tierpool_id, tp)->clear_tier(); + pg_pool_t *np = pending_inc.get_new_pool(pool_id, p); + pg_pool_t *ntp = pending_inc.get_new_pool(tierpool_id, tp); + if (np->tiers.count(tierpool_id) == 0 || + ntp->tier_of != pool_id || + np->read_tier == tierpool_id) { + wait_for_finished_proposal(new C_RetryMessage(this, m)); + return true; + } + np->tiers.erase(tierpool_id); + ntp->clear_tier(); ss << "pool '" << tierpoolstr << "' is now (or already was) not a tier of '" << poolstr << "'"; wait_for_finished_proposal(new Monitor::C_Command(mon, m, 0, ss.str(), get_last_committed() + 1)); -- 2.39.5