Skip to content

mon: do not ack osd new until cephx can auth as osd.N - #71248

Merged
baum merged 2 commits into
ceph:mainfrom
baum:wip-mon-osd-new-cephx-race
Sep 22, 2026
Merged

baum merged 2 commits into
ceph:mainfrom
baum:wip-mon-osd-new-cephx-race

Conversation

@baum

@baum baum commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

mon: do not ack osd new until cephx can auth as osd.N

Until PR #50503 (“mon: use wait_for_commit to reply”), osd new used wait_for_finished_proposal.

osd new mutates AuthMonitor (and KVMonitor for lockbox) in the same plugged Paxos transaction as the osdmap update, but the client waited on OSDMonitor::wait_for_commit. PaxosService::refresh also woke waiting_for_commit before _update_from_paxos(). With refresh order OSDMAP then AUTH, the command could return while KeyServer still lacked osd.N.

That race wedged ceph-nvmeof vstart CI: osd.2 mkfs authenticated 14ms before auth vN applied, failed with EACCES, wrote no type file, and vstart still started the OSD.

Seen in:
https://github.com/ceph/ceph-nvmeof/actions/runs/32452671723/job/97162876156 (pytest multi_gateway, tentacle_9.2, sha d7e3a1c)

Same-run sibling that got a healthy cluster:
https://github.com/ceph/ceph-nvmeof/actions/runs/32452671723/job/97162876249

  • finish waiting_for_commit after _update_from_paxos()
  • osd new waits on AuthMonitor (KVMonitor if lockbox)
  • vstart: --no-mon-config on mkfs; abort if type is missing (replaces the retry that only hid the window)

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.

@baum
baum requested a review from a team as a code owner August 23, 2026 11:13
@baum
baum requested review from batrick and tchaikov and a balanced review from Copilot August 23, 2026 12:50

Copilot AI 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.

Pull request overview

Fixes an osd new race where acknowledgment could precede cephx state availability.

Changes:

  • Applies Paxos state before waking commit waiters.
  • Waits for Auth/KV commits when creating OSD credentials.
  • Adds regression coverage and hardens vstart OSD formatting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/vstart.sh Adjusts OSD mkfs handling and validation.
src/mon/PaxosService.cc Reorders state application and waiter completion.
src/mon/OSDMonitor.h Declares the OSD creation wait helper.
src/mon/OSDMonitor.cc Waits for dependent Auth/KV state.
qa/workunits/cephtool/test.sh Verifies credentials are readable after creation.
qa/standalone/mon/osd-new-mkfs.sh Adds an immediate-mkfs regression test.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vstart.sh Resolved
@baum
baum force-pushed the wip-mon-osd-new-cephx-race branch from 06c7c13 to 03118c2 Compare August 23, 2026 16:01
Comment thread qa/standalone/mon/osd-new-mkfs.sh Resolved
Comment thread src/mon/PaxosService.cc Resolved
Comment thread qa/standalone/mon/osd-new-mkfs.sh Resolved
Comment thread src/vstart.sh Outdated
# config: do_balance_cpu stores crimson_cpu_num/crimson_cpu_set
# only there, and get_early_config() aborts without them.
# osd new now waits until cephx can auth as osd.N, so Crimson
# talking to the mon is safe. Abort if mkfs wrote no type file.

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.

so this partially reverts 49e8a07 ?

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.

yes, Kefu. 49e8a07 retried mkfs over this race. the mon now waits until KeyServer can serve osd.N, so the retry goes away. fail if type is missing instead of looping.
WDYT?

Comment thread src/mon/OSDMonitor.cc Resolved
wait_for_commit used to run from PaxosService::refresh() before
_update_from_paxos(), and OSDMAP refreshes before AUTH. After 53ea121
("mon: use wait_for_commit to reply"), osd new could ack while KeyServer
still lacked osd.N. handle_auth_request() serves KeyServer on the msgr
path without mon.lock.

Complete waiters in post_refresh() instead, after every service has
run _update_from_paxos(). Replies are slightly later than refresh() but
still earlier than wait_for_finished_proposal (_active()).

Signed-off-by: Alexander Indenbaum <[email protected]>
@baum
baum force-pushed the wip-mon-osd-new-cephx-race branch from 03118c2 to 91e4212 Compare September 9, 2026 12:25
@baum
baum requested review from batrick and tchaikov September 9, 2026 14:40
Comment thread src/mon/PaxosService.cc Resolved
Comment thread qa/standalone/mon/osd-new-mkfs.sh Resolved
wait_for_commit now completes in post_refresh(), so osd new's existing
OSDMonitor wait is enough: KeyServer has applied the plugged auth
incremental before the ack.

That race wedged ceph-nvmeof vstart CI: osd.2 mkfs authenticated 14ms
before auth vN applied, failed with EACCES, wrote no type file, and
vstart still started the OSD.

- standalone + cephtool: osd new then immediate auth get / mkfs
- vstart: abort if mkfs wrote no type file; drop the 49e8a07 retry
  that only hid the window

Signed-off-by: Alexander Indenbaum <[email protected]>
@baum
baum force-pushed the wip-mon-osd-new-cephx-race branch from 813be53 to 6919d34 Compare September 18, 2026 09:39
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath17-testing-20260919.063401-main.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@baum
baum merged commit acb358b into ceph:main Sep 22, 2026
17 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.

6 participants