Repository navigation
umbrella: mds: do not replicate an xlocked dentry whose linkage is projected - #73625
Merged
Merged
Conversation
handle_discover lets a path_locked discover replicate an xlocked
dentry. The exception exists for the xlocker's own witnesses, which
traverse the paths before the xlocker projects anything: a rename leader
sends rename_prep only after it holds all locks, and calls
_rename_prepare only after every witness has acked. MDiscover does not
carry a request id, though, so any peer that traverses with
MDS_TRAVERSE_PATH_LOCKED gets the exception, including one working for an
unrelated request. open_remote_dentry with want_xlocked, as used by
handle_peer_rename_prep and handle_peer_rmdir_prep, discovers the primary
dentry of the inode it is opening that way.
If that dentry belongs to a rename that has already projected its new
linkage and is waiting for its journal entry, the new replica gets the
old linkage and is not a witness. When the rename commits,
_rename_finish sends MDentryLink for destdn to every replica that did not
witness it, on the assumption that such a replica is null. A replica of a
rename-over destdn is not null, so handle_dentry_link fails its assertion
that the replica is null. A late replica of srcdn is never told that the
name became null, which can trip the same assert the next time the name
is linked.
early_reply already relies on this not happening. It leaves a rename's
dentry xlocks undone for exactly this reason:
// so do not set xlocks on dentries "done", the xlocks prevent dentries
// that have projected linkages from getting new replica.
The path_locked exception bypasses that.
One way to get there: a client renames over the primary link of a hard
linked inode. The rename has no journaled peers, so it gets an early
reply. Its inode xlocks become xlockdone, and the same client can take
them over at once; without the early reply the two renames would
serialize on those xlocks. The client then renames over another link of
the same inode. A rank that witnesses this second rename and does not
have the inode in cache opens it, discovers the primary dentry, still
xlocked by the first rename, and receives its pre-rename linkage. A
moment later the first rename commits and sends that rank MDentryLink.
If both renames move links of one source inode, as when a tool replaces
every link of a set with links to a new inode, that witness is not the
source inode's auth: such a witness journals, so the first rename would
not have been early-replied. It is a witness because it still holds a
replica of srcdn or destdn, for example one left behind after the
directory's subtree was exported, while it no longer has the inode
itself in cache.
Reproduced on v18.2.7 with two active ranks and one client. /d is
pinned to rank 1 and /d/C to rank 0; /d/A/f is the primary link of
inode O, /d/B/f1 a remote link to O, /d/C/u the primary link of U and
/d/B/.stg1 a remote link to U. With mds_log_pause set on rank 1,
renaming /d/A/T over /d/A/f gets an early reply, and renaming
/d/B/.stg1 over /d/B/f1 makes rank 0, the auth of U, a witness. Its
rename_prep opens O, and rank 1 logs "handle_discover allowing discovery of xlocked
[dentry #0x1/d/A/f ... pv=16 v=8 ...]". When the log is unpaused,
_rename_finish sends MDentryLink for /d/A/f, and rank 0 fails the
assertion in handle_dentry_link. With this change, rank 1 logs
"handle_discover blocking on xlocked" for /d/A/f, the second rename
completes once the first commits, and neither rank aborts.
Allow the path_locked exception only while the dentry has no projected
linkage. After that, block on the xlock the same way a normal discover
does. The xlocker no longer depends on any peer, so it will finish and
drop the xlock, and the discover is retried against the committed
linkage. The xlocker's own witnesses are unaffected because they never
discover after it projects. Nudge the log when blocking: an
early-replied xlocker defers its journal flush, and the discover, and
any peer request waiting behind it, should not wait for the next tick.
Also drop the comments about tail items. They have been stale since
commit cac3c01, "mds: change MDCache::discover_path()'s
wants_xlocked semantic", made the exception apply at every depth.
Signed-off-by: Anthony D'Atri <[email protected]>
Assisted by Claude Opus-5.5
(cherry picked from commit d0a7454)
With two active ranks, rename a file over the primary link of a hard linked inode on rank 1 while rank 1's journal is paused, so the rename gets an early reply and keeps its new linkage projected. Then rename a remote link of an inode on rank 0 over another link of the same inode. Rank 0 is a witness of that rename, and its rename_prep discovers the primary dentry still xlocked by the first rename. Check that rank 0 is still running, with the same gid, after the journal is unpaused, and that both renames took effect. Without the fix, the discover returns the pre-rename linkage, and the first rename's MDentryLink fails ceph_assert(dnl->is_null()) on rank 0. Fixes: https://tracker.ceph.com/issues/81730 Assisted-by: LLM Signed-off-by: Xiubo Li <[email protected]> (cherry picked from commit 14fcfe1)
vshankar
approved these changes
Nov 9, 2026
Contributor
|
This PR has been added to wip-yuri6-testing-20261111.163544-umbrella. |
vshankar
approved these changes
Nov 13, 2026
Member
|
This PR has been added to umbrella integration testing by pdonnell started 2026-11-21-05:14. |
batrick
approved these changes
Nov 23, 2026
yuriw
added a commit
that referenced
this pull request
Nov 30, 2026
yuriw
added a commit
that referenced
this pull request
Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport tracker: https://tracker.ceph.com/issues/82862
backport of #72790
parent tracker: https://tracker.ceph.com/issues/81730
handle_discoverlets apath_lockeddiscover replicate an xlocked dentry. The exception is meant for the xlocker's own witnesses, butMDiscovercarries no request id, so a peer working on another request gets it too, for examplehandle_peer_rename_prepopening a remote dentry's inode. If the dentry belongs to a rename that has already projected its new linkage, such as an early-replied rename waiting on its journal entry, the new replica gets the old linkage and is not a witness. When the rename commits,_rename_finishsendsMDentryLinkto that replica, and the peer failsceph_assert(dnl->is_null())inMDCache::handle_dentry_link.This change allows the exception only while the dentry has no projected linkage. Otherwise the discover blocks on the xlock as a normal discover does, and the log is nudged so an early-replied xlocker does not hold it until the next tick. The xlocker's own witnesses all traverse before it projects, so they are unaffected.
Testing: reproduced deterministically on v18.2.7 with two active ranks, one kernel client and
mds_log_pauseon the rename leader. The reproducer script, debug_mds 20 logs from both ranks and the sequence are on the tracker. Without this change the peer rank aborted in 2 of 2 runs. With it, cherry-picked onto v18.2.7, it aborted in 0 of 2: the auth rank logshandle_discover blocking on xlocked, and the second rename completes once the first commits. The diff is identical on main.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
Clean cherry-pick of 2 commits, with the same line changes as on main.