Bug #81340
openmgr: MgrOpRequest::mark_finish_mon_command passes flag_start_mon_command instead of flag_finish_mon_command (copy-paste bug)
0%
Description
MgrOpRequest::mark_finish_mon_command (src/mgr/MgrOpRequest.h:122) passes the wrong flag constant to the op-tracker infrastructure. Due to a copy-paste error, it passes flag_start_mon_command instead of flag_finish_mon_command:
void mark_finish_mon_command() {
mark_flag_point(flag_start_mon_command); // line 122 -- should be flag_finish_mon_command
}
Consequences: (1) the state display for a finishing mon command incorrectly shows "start" state; (2) the 0x10 finish bit is never set in the op-tracker flag word, so any code that checks flag_finish_mon_command to determine whether the command has completed will never see it set.
Failure scenario¶
Calling mark_finish_mon_command() advances the op-tracker through the start-of-command state a second time rather than the finish-of-command state. Operator tools (ceph mgr dump, slow-op reports) show misleading state for in-flight mon commands.
Suggested fix¶
void mark_finish_mon_command() {
mark_flag_point(flag_finish_mon_command);
}
Unit test (illustrative)¶
TEST(MgrOpRequest, MarkFinishMonCommandSetsCorrectFlag) {
MgrOpRequest op(...);
op.mark_start_mon_command();
op.mark_finish_mon_command();
EXPECT_TRUE(op.state_flags() & MgrOpRequest::flag_finish_mon_command);
EXPECT_FALSE(op.state_flags() & MgrOpRequest::flag_start_mon_command); // should not be set twice
}
SZ Updated by Steven Zuraski 2 months ago
- Status changed from New to Fix Under Review
- Pull request ID set to 72357
SZ Updated by Steven Zuraski about 1 month ago
- Related to Bug #82136: mgr/DaemonServer: op-tracker marks mon command finished before the mon reply arrives added
SZ Updated by Steven Zuraski 23 days ago
- Related to Enhancement #83014: mgr: add sanity/smoke test scenarios covering MgrOpRequest flag-point ordering for mon commands added