Skip to content

nvmeofgw:fix forcing unavalable gw exit by sending - #68650

Merged
SrinivasaBharath merged 1 commit into
ceph:mainfrom
leonidc:fix_force_exit_gw
Jun 13, 2026
Merged

SrinivasaBharath merged 1 commit into
ceph:mainfrom
leonidc:fix_force_exit_gw

Conversation

@leonidc

@leonidc leonidc commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

In some cases when monitor detects that GW is out of sync with it, need to force GW exit and restart.
Example is scenario when GW is marked unavailable in the database of monitor due to detected beacon timeout but GW continues sending beacons marking itself being in Available state (first beacon from the GW after startup sent in Created state by the protocol rules)
The agreed way to cause GW exit is that monitor sends UNAVAILABLE state to it in the map. But this not always works we need more reliable solution.

So this PR forces unavailable gw exit by sending empty map to it. In the previous implementation the map with unavailable state was sent but it does not guarantee GW exit because GW mon client always compares maps - if map did not change it just ignored. Empty map with just epoch in it for sure differs from the previously stored map, so GW would exit

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@leonidc
leonidc requested a review from a team as a code owner April 28, 2026 08:54
@leonidc
leonidc requested a review from rzarzynski May 3, 2026 13:10
@caroav
caroav requested a review from bill-scales May 10, 2026 12:01

@bill-scales bill-scales left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give a bit more explanation of the change on lines 1118-1122 of NVMeofGwMon.cc. I get that you need to transition out of GW_UNAVAILABLE when the GW returns, otherwise we will continue to send the GW empty maps, but why is it safe to transition to GW_CREATED?

Am I right in thinking that this is safe because the next state transition to GW_AVAILABLE/GW_STANDBY will happen in NVMeofGwMap::process_gw_map_ka and that this function treats GW_CREATED and GW_UNAVAILABLE exactly the same

Comment thread src/mon/NVMeofGwMap.cc
gw_created.availability == gw_availability_t::GW_UNAVAILABLE) {
dout (4) << "GW " << gw_id << " Send empty unicast map in state "
<< gw_created.availability << dendl;
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK: While a gateway is GW_UNAVAILABLE make sure it doesn't get included in the gateway map

@leonidc leonidc May 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I need transition out of GW_UNAVAILABLE when the GW returns, otherwise we will continue to send the GW empty maps and it keep reset . We need send empty map when it becomes Unavailable, not from the beginning of its life . I think transition to Created is safe. I added the code on lines 1118-1122 during debug

Comment thread src/mon/NVMeofGwMon.cc
gw_availability_t::GW_UNAVAILABLE) {
pending_map.created_gws[group_key][gw_id].availability =
gw_availability_t::GW_CREATED; // prevent sending empty map to this GW after restart
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK: When the gateway returns we have to move it out of the GW_UNAVAILABLE state otherwise we won't add it to the map. The GW_CREATED state (I think this represents a newly created but not yet available GW) is a suitable choice, I think we then transition to GW_AVAILABLE/GW_STANDBY in process_gw_map_ka??

Comment thread src/mon/NVMeofGwMon.cc
@@ -1149,11 +1154,9 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op)
false) &&
(avail == gw_availability_t::GW_AVAILABLE ||
avail == gw_availability_t::GW_UNAVAILABLE )) {
ack_map.created_gws[group_key][gw_id] =
pending_map.created_gws[group_key][gw_id];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is necessary to delete this as the modification in NVMeofGwMap::to_gmap will ensure that this gets filtered out of the map sent in the reply message, but given that we know that is going to happen it doesn't harm not to add it to ack_map

@leonidc leonidc May 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bill-scales , map to the GWs is sent in two ways :
1 . unicast map in NVMeofGwMap::to_gmap (per update_from_paxos)
2. map response do_send_map_ack . we need it as GW MonClient uses maps as keep alive. it exits if does not receive map in 100 sec.

So If I want gw exits immediately I have to send it empty map as response and not wait for new paxos epoch

@bill-scales bill-scales left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, happy with the changes

@caroav

caroav commented May 17, 2026

Copy link
Copy Markdown
Contributor

jenkins make check arm64

@rzarzynski rzarzynski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a tiny little nit: there is the typo ("unavalable") in the commit title.

         empty map to it

Signed-off-by: Leonid Chernin <[email protected]>
@leonidc
leonidc force-pushed the fix_force_exit_gw branch from e23ac9c to 8e32fff Compare May 25, 2026 06:48
@leonidc

leonidc commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

@rzarzynski , thanks , corrected the title

@sseshasa

Copy link
Copy Markdown
Contributor

@SrinivasaBharath
SrinivasaBharath merged commit 7ab9488 into ceph:main Jun 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants