Skip to content

Commit 5288e75

Browse files
authored
Merge pull request ceph#56132 from ronen-fr/wip-rf-unreserve
osd/scrub: handle 'release' events sent during 'scrub abort' Reviewed-by: Samuel Just <[email protected]>
2 parents 694f19b + 0f0c393 commit 5288e75

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/osd/scrubber/scrub_machine.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ void ReplicaActive::clear_remote_reservation(bool warn_if_no_reservation)
886886
dout(10) << fmt::format(
887887
"ReplicaActive::clear_remote_reservation(): "
888888
"pending_reservation_nonce {}, reservation_granted {}",
889-
reservation_granted, pending_reservation_nonce)
889+
pending_reservation_nonce, reservation_granted)
890890
<< dendl;
891891
if (reservation_granted || pending_reservation_nonce) {
892892
m_osds->get_scrub_reserver().cancel_reservation(pg_id);
@@ -1149,6 +1149,14 @@ sc::result ReplicaActiveOp::react(const StartReplica&)
11491149
return transit<ReplicaActiveOp>();
11501150
}
11511151

1152+
sc::result ReplicaActiveOp::react(const ReplicaRelease& ev)
1153+
{
1154+
dout(10) << "ReplicaActiveOp::react(const ReplicaRelease&)" << dendl;
1155+
post_event(ev);
1156+
return transit<sc::shallow_history<ReplicaReserved>>();
1157+
}
1158+
1159+
11521160
// ------------- ReplicaActive/ReplicaWaitUpdates ------------------------
11531161

11541162
ReplicaWaitUpdates::ReplicaWaitUpdates(my_context ctx)

src/osd/scrubber/scrub_machine.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ struct ReplicaActiveOp
10471047

10481048
using reactions = mpl::list<
10491049
sc::custom_reaction<StartReplica>,
1050+
sc::custom_reaction<ReplicaRelease>,
10501051
sc::transition<FullReset, ReplicaIdle>>;
10511052

10521053
/**
@@ -1060,6 +1061,15 @@ struct ReplicaActiveOp
10601061
* - and we should log this unexpected scenario clearly in the cluster log.
10611062
*/
10621063
sc::result react(const StartReplica&);
1064+
1065+
/**
1066+
* a 'release' was send by the primary. Possible scenario: 'no-scrub'
1067+
* abort. Our two-steps reaction:
1068+
* - we exit the 'ActiveOp' state, and
1069+
* - we make sure the 'release' is remembered, to be handled by the state
1070+
* we would transition into (which should be ReplicaReserved).
1071+
*/
1072+
sc::result react(const ReplicaRelease&);
10631073
};
10641074

10651075
/*

0 commit comments

Comments
 (0)