Repository navigation
mds: don't ack dirfrag replicas whose inode isn't replicated to the peer - #73264
Conversation
Config Diff Tool Output+ added: mds_debug_rejoin_ack_delay (mds.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
/config check ok |
|
@vshankar could you assign a CephFS reviewer for this one? |
|
@salieri11 - can you please review this? (the weak/strong rejoin code paths is probably fresh in your memory) |
vshankar
left a comment
There was a problem hiding this comment.
The fix looks sound... but no yaml runs qa/tasks/cephfs/test_rejoin.py :(
@anthonyeleven please fix up that bit.
| return ino | ||
| return None | ||
|
|
||
| def test_rejoin_ack_isolated_inode(self): |
There was a problem hiding this comment.
I don't think this reliably reproduces the issue. Let me play around with this a bit more.
There was a problem hiding this comment.
Agreed. It hasn't run under teuthology yet, and it only asserts that the survivor stays up, so a run that misses the window passes.
On 18.2.8 the crash needed two things:
- X fully cold on the recovering rank: one level below the pinned directory, with nothing replayed for it.
- The survivor trimming the whole path down to X, not just X's leaf, inside the ack delay.
The test gets the first from flush journal before the fail. It aims at the second with a fixed 8 s sleep after up:rejoin, then cache drop 0. Those are the two places I'd expect it to miss.
There was a problem hiding this comment.
The reworked test now reproduces it. Under vstart_runner, 3 of 3 runs failed without the fix (the survivor aborted on the assert) and 3 of 3 passed with it. What changed and the numbers are in #73264 (comment).
There was a problem hiding this comment.
Thanks for revising the version. I will have a look.
fa58b1c to
84fb53c
Compare
|
Pushed a reworked test, folded into the one qa commit. The old version couldn't reach the race:
It now gives the child an entry, clears its pin after the round trip, unmounts before flushing the journal, and drops the survivor's cache only once the recovering rank holds more than one of X's dirfrags. After the recovering rank goes active it watches the survivor in the FSMap instead of with a tell, because a tell to an MDS that is still writing its core never returns. It also runs in fs:functional now ( A/B under vstart_runner (4 MDS, 3 active), the same build with and without 580e193:
|
|
jenkins test make check |
|
We hit this assert in production today on Reef 18.2.8, which already includes #56747 (the reef backport of #52648).
|
I understand. We need to include this fix in the next point-releases. I am reviewing this on prio and will put it to test if everything looks fine. Thanks for the quick turnaround on this @anthonyeleven |
vshankar
left a comment
There was a problem hiding this comment.
Minor comments. Otherwise LGTM.
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
handle_cache_rejoin_ack() on a surviving (active) MDS builds an isolated_inodes set for every acked strong dirfrag whose inode it no longer has in cache, and then asserts that set is empty, expecting a dentry in the same ack to reconnect each one: // FIXME: This can happen if entire subtree, together with the inode // subtree root belongs to, were trimmed between sending cache rejoin // and receiving rejoin ack. ceph_assert(isolated_inodes.empty()); A recovering rank can send exactly such an ack. When it processes a peer's strong rejoin for a fragmented directory it does not have in cache, rejoin_invent_dirfrag() invents a single frag_t() dirfrag and records the peer as its replica. After the inode is fetched, opened_undef_inode() -> CInode::force_dirfrags() splits that invented dirfrag, and CDir::split() copies the replica map onto every leaf, so the peer is now recorded as a replica of leaves it never held. If the peer then trims that directory and sends a cache expire before we send our rejoin ack, handle_cache_expire() removes the peer from the inode and from the few leaves named in the expire, but the other leaves keep the stale replica. rejoin_send_acks() then acks those leaves to the peer without acking the inode (it is no longer a replica), and the peer crashes on the isolated_inodes assert. A dirfrag replica cannot exist without an inode replica, so acking a dirfrag to a peer that we do not record as a replica of its inode is never correct. In rejoin_send_acks(), for inodes we are authoritative for, skip acking a dirfrag to such a peer and drop the stale replica. Base inodes, and inodes we are not authoritative for (the subtree-root case the FIXME describes), are left alone. This does not rely on replica nonces, which are unreliable here because split() gives every leaf the parent frag's nonce. Subtree-root dirfrags are excluded as well. rejoin_send_acks() walks the subtree map in pointer order, and the "peer missed MDentryLink" fix-up adds an inode replica only while processing the parent dir's dentries. Inside one subtree's walk that always happens before the child dirfrags are visited, so the inode's replica map is final when the check runs. A subtree root whose inode is auth here but lives in another of our subtrees (export pins can keep same-auth subtrees apart) may be visited before that fix-up, and the check could then drop a legitimate replica. Subtree roots are known after replay from ESubtreeMap and are never invented and split, so the stale-replica case does not arise for them. Fixes: https://tracker.ceph.com/issues/80407 Signed-off-by: Anthony D'Atri <[email protected]> Assisted-by: Claude Opus-5.5
The isolated_inodes crash in handle_cache_rejoin_ack() (tracker 80407) depends on a surviving peer trimming a directory and sending a cache expire in the short window between a recovering rank fetching an invented, fragmented inode and that rank sending its rejoin acks. By hand the window is too small to hit reliably. Add a dev-only option, mds_debug_rejoin_ack_delay, that defers rejoin_send_acks() by the configured number of seconds once the undef dirfrags have been fetched. The delay is a timer event, not a sleep, so the rank keeps dispatching messages and keeps processing the peer's cache expire while it waits; this widens the race rather than masking it. Default 0 (disabled); used by the qa reproducer. The rank stays in rejoin_ack_gather while the event is queued, so rejoin_gather_finish() can be called again. Keep the event and return early while it is set: the acks go out once, when it fires, and the gather steps aren't repeated. Signed-off-by: Anthony D'Atri <[email protected]> Assisted-by: Claude Opus-5.5
Add TestCacheRejoin.test_rejoin_ack_isolated_inode for tracker 80407, and run it in fs:functional, whose cluster has the four MDS daemons it needs. A fragmented directory X, authoritative on rank R, is replicated on a survivor S (inode plus one leaf frag). R is failed; the new R has no X in cache, invents it from S's strong rejoin, and splits it once it learns the fragtree, so S is recorded on every leaf. S then trims X and sends a cache expire before R acks. Before the fix R acked the orphan leaves and S crashed on ceph_assert(isolated_inodes.empty()). R only invents X if nothing it replays or reopens names X, so the test: - moves a child of X to S and back, then clears the pin, so S holds an ordinary replica and R's subtree map doesn't journal X; - unmounts the client before flushing R's journal, since reconnected caps are opened from disk before rejoins are sent; - drops S's cache only once R holds more than one of X's dirfrags: an expire that arrives before the split prevents the bug. mds_debug_rejoin_ack_delay holds R's acks for 60 seconds, which makes the window deterministic. After R goes active the test watches S in the FSMap for a beacon timeout instead of asking it for status: an MDS still writing its core never answers a tell. Signed-off-by: Anthony D'Atri <[email protected]> Assisted-by: Claude Opus-5.5
84fb53c to
3acd5a1
Compare
test_rejoin_ack_isolated_inode passed whenever the survivor stayed up, which it also does when the race is missed, for example when the expire arrives before the split, so a pass didn't prove the fix. After recovery, require the recovering rank's log to show that it dropped a stale replica instead of acking it. Ask the daemon for its log path, since it differs between teuthology and vstart_runner. fs:functional runs with debug mds 20, and the line is logged at 10. Fixes: https://tracker.ceph.com/issues/80407 Signed-off-by: Anthony D'Atri <[email protected]> Assisted-by: Claude Opus-5.5
|
PR is good to go when all checks are green |
|
jenkins test make check |
|
jenkins test make check arm64 |
|
jenkins test api |
|
jenkins test windows |
|
jenkins test signed |
|
jenkins test submodules |
|
jenkins test make check |
|
jenkins test make check |
salieri11
left a comment
There was a problem hiding this comment.
LGTM, thanks for working on this one!
xiubli
left a comment
There was a problem hiding this comment.
Good catch. LGTM.
I have run the tests/regressions and no issue found.
|
This PR has been added to main integration testing by vshankar started 2026-11-24-04:06. |
Fixes: https://tracker.ceph.com/issues/80407
A surviving (active) MDS can abort in
MDCache::handle_cache_rejoin_ack()onceph_assert(isolated_inodes.empty())while peer ranks are in up:rejoin. This is tracker 80407, the same assert as 62036 and 50821, and distinct from 80402 and 54840.The crash starts on the recovering rank. When it processes a surviving peer's strong rejoin for a fragmented directory that it does not have in cache, it invents a single
frag_t()dirfrag and records the peer as a replica of it. After it fetches the inode,opened_undef_inode()→CInode::force_dirfrags()splits that dirfrag, andCDir::split()copies the replica map onto every leaf, so the peer is now recorded as a replica of leaves it never held. If the peer then trims the directory and sends a cache expire before the recovering rank sends its acks, the expire removes the peer from the inode and from the leaves it actually had, but the remaining leaves keep the stale replica. The 2014 sweep inhandle_cache_expire()only runs when the named dirfrag is missing, so it doesn't catch this.rejoin_send_acks()then acks those leaves to the peer without the inode, the peer builds an unconnected dirfrag that nothing in the ack links, and the assert fires. The deferral from #52648 doesn't help, because it keys onrejoin_done, which is null on an active survivor.A dirfrag replica cannot exist without an inode replica, so acking a dirfrag to a peer we don't record as a replica of its inode is never correct. This drops such stale replicas in
rejoin_send_acks()instead of acking them, for inodes we are authoritative for. Base inodes, inodes we are not authoritative for (the subtree-root case the in-tree FIXME describes) and subtree-root dirfrags are left alone. Subtree roots are known from the subtree map after replay and are never invented and split, and the walk can reach one before the "peer missed MDentryLink" fix-up has run for its inode. The check doesn't rely on replica nonces, which are unreliable after a split.The race window is short, so this also adds a dev-only option,
mds_debug_rejoin_ack_delay(default 0), that defersrejoin_send_acks()with a timer while the rank keeps processing messages. The new test inqa/tasks/cephfs/test_rejoin.py, run in fs:functional, uses it: a fragmented directory one level below an export-pinned directory, a survivor holding an ordinary replica of its inode and one leaf, no client caps and no subtree root at or below it; fail the auth rank, and drop the survivor's cache once the recovering rank has split the directory. Under vstart_runner it failed 3 of 3 runs without the fix (the survivor aborted on the assert) and passed 3 of 3 with it. It has not run under teuthology yet.Reproduced on 18.2.8 with three active ranks and the delay backported. Stock crashed the survivor on the assert. With the fix, the recovering rank logged dropping 26 stale leaf replicas instead of acking them, the survivor stayed up, and all ranks went active.
@vshankar @batrick @xiubli
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.
Signed-off-by: Anthony D'Atri [email protected]
Assisted-by: Claude Opus-5.5