Skip to content

mds: populate rejoin_gather for newly active ranks - #71644

Merged
vshankar merged 5 commits into
ceph:mainfrom
salieri11:igolikov-fix-cache-rejoin-weak-bug-80402
Nov 10, 2026
Merged

vshankar merged 5 commits into
ceph:mainfrom
salieri11:igolikov-fix-cache-rejoin-weak-bug-80402

Conversation

@salieri11

Copy link
Copy Markdown
Contributor

A rank that goes creating -> active during max_mds scale-up never observes peer failures, so rejoin_gather stays empty while recovery_set is not. OP_WEAK then hits ceph_assert(rejoin_gather.count(from)). Grow gather from set_recovery_set and the survivor rejoin send path, refresh the recovery set at joint start, and add or ignore a missing sender instead of crashing.

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

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.

@github-actions github-actions Bot added the cephfs Ceph File System label Sep 9, 2026
@salieri11
salieri11 requested a review from vshankar September 9, 2026 07:56
@vshankar
vshankar requested a review from xiubli September 15, 2026 16:40
@dparmar18

Copy link
Copy Markdown
Contributor

lets call: R = recovering rank and N = new rank

so basically R's old daemon failed and its new replacement was already promoted to R when N was still creating therefore the last mdsmap N processed (oldmap) already contained the replacement i.e. the oldmap's info.inc and the current mdsmap's info.inc are the same and since this rank is not down -- none of the handle_mds_failure(r) are reached by N so it never could actually add R to it's rejoin_gather set but when R handles the mds map and hits if ((!oldmap.is_resolving() || !restart.empty()) && mdsmap->is_resolving()) {calc_recovery_set()} it adds N to its recovery_set, provided N had already become active i.e. N went active while R was still in replay. When R reaches up:rejoin and the map becomes is_rejoining(), rejoin_joint_start() -> rejoin_send_rejoins() sends an OP_WEAK to every rank in R's recovery_set including N and then N handles it in the survivor branch of handle_cache_rejoin_weak() and fails at ceph_assert(rejoin_gather.count(from)).

@dparmar18

Copy link
Copy Markdown
Contributor

@salieri11 this makes sense to me, looks good. Is a test case possible for this? a test case can be timed where basically you start the new mds when the recovering rank's new incarnation has already been promoted to that rank my mon? i think once the new rank sees that it's old mdsmap and the current one has both the inc's same for this recovering rank, it will be reproduced, right?

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

Good work in identifying the cause @salieri11

The changes in active_start() and set_recovery_set() isn't required since those changes do no fix the crash.

Comment thread src/mds/MDCache.cc Resolved
Comment thread src/mds/MDSRank.cc Resolved
Comment thread src/mds/MDCache.cc Resolved
@salieri11
salieri11 force-pushed the igolikov-fix-cache-rejoin-weak-bug-80402 branch from 80d433f to 0eb7c78 Compare November 2, 2026 13:39
@salieri11
salieri11 requested a review from a team as a code owner November 2, 2026 13:39
@salieri11

Copy link
Copy Markdown
Contributor Author

@vshankar thanks for the review, all comments has been addressed

salieri11 and others added 5 commits November 4, 2026 08:28
A rank that goes creating -> active during max_mds scale-up never
observes peer failures, so rejoin_gather stays empty while recovery_set
is not. OP_WEAK then hits ceph_assert(rejoin_gather.count(from)). Grow
gather from set_recovery_set and the survivor rejoin send path, refresh
the recovery set at joint start, and add or ignore a missing sender
instead of crashing.

Fixes: https://tracker.ceph.com/issues/80402
Related-to: https://tracker.ceph.com/issues/54840
Signed-off-by: Igor Golikov <[email protected]>
Do not re-insert a rank into rejoin_gather after its OP_WEAK was
already applied when a delayed rejoin_send_rejoins() retries. Drop
gather updates from set_recovery_set() and active_start(); they do not
fix the crash and can wait on peers that will never send again.

Fixes: https://tracker.ceph.com/issues/80402
Related-to: https://tracker.ceph.com/issues/54840
Signed-off-by: Igor Golikov <[email protected]>
A second weak rejoin from a rank still in replay..rejoin is no longer
in rejoin_gather, so handle_cache_rejoin_weak() applied it again. Skip
senders already recorded in rejoin_weak_applied. handle_mds_failure()
clears that bit when a new rejoin is required.

Fixes: https://tracker.ceph.com/issues/80402
Signed-off-by: Venky Shankar <[email protected]>
OP_STRONG is sent only by a clientreplay, active, or stopping rank.
Dropping it when the local map does not show that state yet loses the
ack, because rejoin_sent prevents a resend. The same drop in
handle_cache_rejoin_weak() loses the ack for a sender outside
replay..rejoin. Wait for the next mdsmap and retry.

Fixes: https://tracker.ceph.com/issues/80402
Signed-off-by: Venky Shankar <[email protected]>
Hold a new rank in creating while a peer fails over into replay, then
let it become active before that peer leaves replay. OP_WEAK then
reaches a survivor that never ran handle_mds_failure().

Fixes: https://tracker.ceph.com/issues/80402
Signed-off-by: Venky Shankar <[email protected]>
@vshankar
vshankar force-pushed the igolikov-fix-cache-rejoin-weak-bug-80402 branch from 0eb7c78 to d587b44 Compare November 4, 2026 05:26
@github-actions github-actions Bot added the tests label Nov 4, 2026
@vshankar

vshankar commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@salieri11 - most changes looks good. I added a couple of commits on top that fix another case that could lead to the MDS crash and a test reproducer.

Without the fix: https://pulpito.ceph.com/vshankar-2026-11-04_05:02:33-fs:functional-wip-fs-suite-ganesha-tests-y-trial1-distro-default-trial/709729/

2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr:/ceph/rpmbuild/BUILD/ceph-22.0.0-186-gf7ffd047/src/mds/MDCache.cc: 4698: FAILED ceph_assert(rejoin_gather.count(from))
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: ceph version 22.0.0-186-gf7ffd047 (f7ffd047eb2b401f7b4c3e7a2188e6933af38fb4) vampire (dev - RelWithDebInfo)
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x12f) [0x7fe65ff96a61]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 2: ceph-mds() [0x4add6a]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 3: (MDCache::dispatch(boost::intrusive_ptr const&)+0x19a) [0x692a6a]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 4: (MDSRank::handle_message(boost::intrusive_ptr const&)+0x152) [0x528a52]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 5: (MDSRank::_dispatch(boost::intrusive_ptr const&, bool)+0x543) [0x52acf3]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 6: (MDSRankDispatcher::ms_dispatch(boost::intrusive_ptr const&)+0x55) [0x52b125]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 7: (MDSDaemon::ms_dispatch2(boost::intrusive_ptr const&)+0x13c) [0x517e2c]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 8: (DispatchQueue::entry()+0x4a8) [0x7fe6601fb6f8]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 9: /usr/lib64/ceph/libceph-common.so.2(+0x489f61) [0x7fe660289f61]
2026-11-04T05:16:23.273 INFO:tasks.ceph.mds.c.trial056.stderr: 10: /lib64/libc.so.6(+0x8b569) [0x7fe65f48b569]
2026-11-04T05:16:23.274 INFO:tasks.ceph.mds.c.trial056.stderr: 11: /lib64/libc.so.6(+0x110760) [0x7fe65f510760]

With the fix: https://pulpito.ceph.com/vshankar-2026-11-04_05:02:02-fs:functional-wip-80402-distro-default-trial/709720/ (PASS)

@vshankar

vshankar commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@salieri11 - once you ack the additional changes, I will run it through fs suite test.

@salieri11

Copy link
Copy Markdown
Contributor Author

@vshankar LGTM, thanks for handling it!

@xiubli xiubli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested locally with vstart_runner and reproduced in base and this PR fixed it. LGTM. Thanks.

Comment thread src/mds/MDSRank.cc Resolved
@vshankar

vshankar commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for the review folks. Appreciate it!

@vshankar

vshankar commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-11-06-10:30.

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

@vshankar
vshankar merged commit d9985e2 into ceph:main Nov 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants