Skip to content

mgr/DaemonServer: move mark_finish_mon_command into ReplyOnFinish::finish() - #73120

Open
stzuraski898 wants to merge 1 commit into
ceph:mainfrom
stzuraski898:wip-sz-82136-daemonserver-mark-finish-timing
Open

stzuraski898 wants to merge 1 commit into
ceph:mainfrom
stzuraski898:wip-sz-82136-daemonserver-mark-finish-timing

Conversation

@stzuraski898

@stzuraski898 stzuraski898 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

ReplyOnFinish::ReplyOnFinish() called op->mark_finish_mon_command() in its constructor body. The constructor runs as soon as the Context is allocated, before monc dispatches the command and before any mon reply arrives. The op-tracker therefore reported "mon command finished" for ops that were still waiting on the mon, for example during a mon election.

Fix

Remove the call from the constructor and make it the first step of ReplyOnFinish::finish(). MonClient invokes finish() when the mon reply arrives, so the finish flag is now set only after the command has completed. The if (op) guard is kept. Nothing else in finish() changes: it still claims from_mon into cmdctx->odata and calls cmdctx->reply(r, outs).

The change is 4 insertions and 5 deletions in src/mgr/DaemonServer.cc.

Impact / likelihood

This is an observability bug, not a functional one. The command path and the reply to the client are unchanged. Only the timing of the op-tracker's "finished mon command" event moves, from before dispatch to reply receipt. It matters when the mon is slow or unavailable, because the old code recorded a finish time for a command that had not run. This affects the reported timing and op-tracker output, such as dump_ops_in_flight and slow-op diagnostics, for these commands.

Fixes: https://tracker.ceph.com/issues/82136

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.

@stzuraski898
stzuraski898 requested a review from a team as a code owner October 26, 2026 21:41
@stzuraski898 stzuraski898 changed the title mgr/DaemonServer: move mark_finish_mon_command into ReplyOnFinish::fi… mgr/DaemonServer: move mark_finish_mon_command into ReplyOnFinish::finish() Oct 26, 2026

@NitzanMordhai NitzanMordhai 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.

@stzuraski898, please mention the other PR that changes mark_finish_mon_command since both of them need to be addressed together

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test api

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

…nish()

ReplyOnFinish::ReplyOnFinish() previously called mark_finish_mon_command()
in the constructor body, which runs as soon as the Context is allocated --
before monc dispatches the command and before any mon reply is received.
This caused the op-tracker to report "mon command finished" for ops that
were still waiting on the mon (e.g. during a mon election).

Move the call into ReplyOnFinish::finish(), which is invoked by MonClient
when the mon reply arrives, so the finish flag is set only after the
command has actually completed.

The same change is also part of ceph#72357
(main commit "mgr: fix MgrOpRequest mon-command flag tracking", tracked
as https://tracker.ceph.com/issues/81340), which additionally fixes
mark_finish_mon_command() passing flag_start_mon_command instead of
flag_finish_mon_command. The two PRs are related and should be fixed in
tandem.

Fixes: https://tracker.ceph.com/issues/82136
Assisted-by: Claude Opus 4.8
Signed-off-by: Steven Zuraski <[email protected]>
stzuraski898 added a commit to stzuraski898/ceph that referenced this pull request Nov 2, 2026
mark_finish_mon_command() was passing flag_start_mon_command to
mark_flag_point() — a copy-paste error.  The finish flag (1 << 4)
was never set; dump_ops_in_flight always showed "start mon command"
regardless of whether the mon had replied.

ReplyOnFinish also called op->mark_finish_mon_command() in its
constructor, before monc->start_mon_command() dispatched the command.
dump_ops_in_flight therefore reported "mon command finished" for ops
still waiting on the mon (e.g. during an election).  Move the call
into ReplyOnFinish::finish() so the flag advances only when the mon
has actually replied.

The ReplyOnFinish change in DaemonServer.cc is the same change made by
ceph#73120 (main commit "mgr/DaemonServer:
move mark_finish_mon_command into ReplyOnFinish::finish()", tracked as
https://tracker.ceph.com/issues/82136). The two PRs are related and
should be fixed in tandem.

Fixes: https://tracker.ceph.com/issues/81340
Assisted-by: IBM Bob
Signed-off-by: Steven Zuraski <[email protected]>
@stzuraski898
stzuraski898 force-pushed the wip-sz-82136-daemonserver-mark-finish-timing branch from 8fe05f0 to 337684b Compare November 2, 2026 21:26
stzuraski898 added a commit to stzuraski898/ceph that referenced this pull request Nov 9, 2026
mark_finish_mon_command() was passing flag_start_mon_command to
mark_flag_point() — a copy-paste error.  The finish flag (1 << 4)
was never set; dump_ops_in_flight always showed "start mon command"
regardless of whether the mon had replied.

ReplyOnFinish also called op->mark_finish_mon_command() in its
constructor, before monc->start_mon_command() dispatched the command.
dump_ops_in_flight therefore reported "mon command finished" for ops
still waiting on the mon (e.g. during an election).  Move the call
into ReplyOnFinish::finish() so the flag advances only when the mon
has actually replied.

The ReplyOnFinish change in DaemonServer.cc is the same change made by
ceph#73120 (main commit "mgr/DaemonServer:
move mark_finish_mon_command into ReplyOnFinish::finish()", tracked as
https://tracker.ceph.com/issues/82136). The two PRs are related and
should be fixed in tandem.

Fixes: https://tracker.ceph.com/issues/81340
Assisted-by: IBM Bob
Signed-off-by: Steven Zuraski <[email protected]>
@stzuraski898

Copy link
Copy Markdown
Contributor Author

Note,337684b is a commit message change, adding a reference to #72357, since these two PRs are related.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

#72357

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test api

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test signed

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test submodules

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins make check

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath29-testing-20261121.045602-main.

@sseshasa

sseshasa commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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.

4 participants