Skip to content

umbrella: client: keep dentry alive while unlinking trimmed cache entries - #70170

Merged
batrick merged 2 commits into
ceph:umbrellafrom
vshankar:wip-77857-umbrella
Aug 5, 2026
Merged

batrick merged 2 commits into
ceph:umbrellafrom
vshankar:wip-77857-umbrella

Conversation

@vshankar

Copy link
Copy Markdown
Contributor

Add ceph_assert(dn->ref > 0) after Dentry::unlink() in Client::unlink()
to catch the case where internal put() calls drop the dentry reference
to zero before we proceed to detach/lru_remove.

This turns a silent use-after-free into a clean assertion failure with
a full stack trace, making it possible to catch the exact conditions
in a test environment.

Signed-off-by: Igor Golikov <[email protected]>
Fixes: https://tracker.ceph.com/issues/74625
(cherry picked from commit 227b558)
Hold a function-scoped DentryRef in Client::unlink() to keep the dentry
alive through the entire teardown sequence.

Without the O_DIRECTORY dentry pin (PR ceph#60909, merged after v19.2.1),
opening a directory does not call _ll_get(), so the dentry stays at
ref=1 while inode->dir is still active. When trim_cache() evicts this
dentry, Dentry::unlink() calls put() for the dir pin, ref drops to 0,
and the dentry is freed while Client::unlink() still needs it for
detach/lru_remove.

A function-scoped DentryRef guarantees the dentry survives until after
it has been properly removed from the dir and LRU, regardless of pin
state.

Signed-off-by: Igor Golikov <[email protected]>
Fixes: https://tracker.ceph.com/issues/74625
(cherry picked from commit ad95bb5)
@vshankar vshankar added this to the umbrella milestone Jul 14, 2026
@vshankar vshankar added the cephfs Ceph File System label Jul 14, 2026
@github-actions github-actions Bot added the releng-audit-pass Release engineering: passed backport verification audit. label Jul 14, 2026
@yuriw yuriw added wip-yuri5-testing and removed cephfs Ceph File System labels Aug 3, 2026
@yuriw

yuriw commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-yuri5-testing-20260803.135213-umbrella.

@vshankar

vshankar commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed-by: Venky Shankar [email protected]

@vshankar vshankar left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@batrick batrick modified the milestones: umbrella, v21.1.1 Aug 5, 2026
@batrick
batrick merged commit 9a1d049 into ceph:umbrella Aug 5, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-qa releng-audit-pass Release engineering: passed backport verification audit. wip-yuri5-testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants