From 57d18f0e8d9b0428a193c63112a28ddd046337b4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 1 Oct 2017 14:59:31 -0500 Subject: [PATCH] osd/PG: move reject_reservation out of RemoteReservationRejected reaction The RemoteReservationRejected event is also submitted when we are a replica or backfill target and get a MBackfillReserve REJECT message because the primary canceled or was preempted. In that case, we don't want to send a REJECT back to the primary; we only need to send it in the cases where *we*, locally, decide to reject. Move the call to those call sites. Signed-off-by: Sage Weil --- src/osd/PG.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 432d536b621..762d83d9d1d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6485,11 +6485,13 @@ PG::RecoveryState::RepNotRecovering::react(const RequestBackfillPrio &evt) (rand()%1000 < (pg->cct->_conf->osd_debug_reject_backfill_probability*1000.0))) { ldout(pg->cct, 10) << "backfill reservation rejected: failure injection" << dendl; + pg->reject_reservation(); post_event(RemoteReservationRejected()); } else if (!pg->cct->_conf->osd_debug_skip_full_check_in_backfill_reservation && pg->osd->check_backfill_full(ss)) { ldout(pg->cct, 10) << "backfill reservation rejected: " << ss.str() << dendl; + pg->reject_reservation(); post_event(RemoteReservationRejected()); } else { pg->osd->remote_reserver.request_reservation( @@ -6519,6 +6521,7 @@ PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteBackfillReserved & (rand()%1000 < (pg->cct->_conf->osd_debug_reject_backfill_probability*1000.0))) { ldout(pg->cct, 10) << "backfill reservation rejected after reservation: " << "failure injection" << dendl; + pg->reject_reservation(); pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); post_event(RemoteReservationRejected()); return discard_event(); @@ -6526,6 +6529,7 @@ PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteBackfillReserved & pg->osd->check_backfill_full(ss)) { ldout(pg->cct, 10) << "backfill reservation rejected after reservation: " << ss.str() << dendl; + pg->reject_reservation(); pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); post_event(RemoteReservationRejected()); return discard_event(); @@ -6545,7 +6549,6 @@ boost::statechart::result PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteReservationRejected &evt) { PG *pg = context< RecoveryMachine >().pg; - pg->reject_reservation(); return transit(); } -- 2.39.5