Skip to content

Commit

Permalink
Merge pull request ceph#56132 from ronen-fr/wip-rf-unreserve
Browse files Browse the repository at this point in the history
osd/scrub: handle 'release' events sent during 'scrub abort'

Reviewed-by: Samuel Just <[email protected]>
  • Loading branch information
ronen-fr authored Mar 15, 2024
2 parents 694f19b + 0f0c393 commit 5288e75
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/osd/scrubber/scrub_machine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ void ReplicaActive::clear_remote_reservation(bool warn_if_no_reservation)
dout(10) << fmt::format(
"ReplicaActive::clear_remote_reservation(): "
"pending_reservation_nonce {}, reservation_granted {}",
reservation_granted, pending_reservation_nonce)
pending_reservation_nonce, reservation_granted)
<< dendl;
if (reservation_granted || pending_reservation_nonce) {
m_osds->get_scrub_reserver().cancel_reservation(pg_id);
Expand Down Expand Up @@ -1149,6 +1149,14 @@ sc::result ReplicaActiveOp::react(const StartReplica&)
return transit<ReplicaActiveOp>();
}

sc::result ReplicaActiveOp::react(const ReplicaRelease& ev)
{
dout(10) << "ReplicaActiveOp::react(const ReplicaRelease&)" << dendl;
post_event(ev);
return transit<sc::shallow_history<ReplicaReserved>>();
}


// ------------- ReplicaActive/ReplicaWaitUpdates ------------------------

ReplicaWaitUpdates::ReplicaWaitUpdates(my_context ctx)
Expand Down
10 changes: 10 additions & 0 deletions src/osd/scrubber/scrub_machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ struct ReplicaActiveOp

using reactions = mpl::list<
sc::custom_reaction<StartReplica>,
sc::custom_reaction<ReplicaRelease>,
sc::transition<FullReset, ReplicaIdle>>;

/**
Expand All @@ -1060,6 +1061,15 @@ struct ReplicaActiveOp
* - and we should log this unexpected scenario clearly in the cluster log.
*/
sc::result react(const StartReplica&);

/**
* a 'release' was send by the primary. Possible scenario: 'no-scrub'
* abort. Our two-steps reaction:
* - we exit the 'ActiveOp' state, and
* - we make sure the 'release' is remembered, to be handled by the state
* we would transition into (which should be ReplicaReserved).
*/
sc::result react(const ReplicaRelease&);
};

/*
Expand Down

0 comments on commit 5288e75

Please sign in to comment.