Skip to content

mgr/nfs: reuse CephfsClient for path checks and earmark resolver - #68842

Merged
rkachach merged 1 commit into
ceph:mainfrom
ShwetaBhosale1:fix_issue_76504_nfs_to_reuse_cephfsclient_cache
May 14, 2026
Merged

rkachach merged 1 commit into
ceph:mainfrom
ShwetaBhosale1:fix_issue_76504_nfs_to_reuse_cephfsclient_cache

Conversation

@ShwetaBhosale1

@ShwetaBhosale1 ShwetaBhosale1 commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

In nfs/utils.py, cephfs_path_is_dir defined an inner function decorated with lru_cache, so each call got a new function object and an empty cache, CephfsClient(mgr) ran every time. Moved caching to module-level cephfs_client_for_mgr(mgr) and call it from cephfs_path_is_dir.
Passed that shared client into CephFSEarmarkResolver from the NFS module so export create/apply does not construct a separate CephfsClient for earmarks.

Fixes: https://tracker.ceph.com/issues/76504
Signed-off-by: Shweta Bhosale [email protected]

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.

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

Pls consider adding tests for:

  1. cephfs_client_for_mgr() returns the same instance on repeated calls with the same mgr
  2. Multiple CephFSEarmarkResolver instances share the same client when passed the cached one

cephfs_path_is_dir defined an inner function decorated with lru_cache, so
each call got a new function object and an empty cache, CephfsClient(mgr)
ran every time. Moved caching to module-level cephfs_client_for_mgr(mgr)
and call it from cephfs_path_is_dir.
Passed that shared client into CephFSEarmarkResolver from the NFS module so
export create/apply does not construct a separate CephfsClient for
earmarks.

Fixes: https://tracker.ceph.com/issues/76504
Signed-off-by: Shweta Bhosale <[email protected]>
@ShwetaBhosale1
ShwetaBhosale1 force-pushed the fix_issue_76504_nfs_to_reuse_cephfsclient_cache branch from 74bf082 to a32fe1e Compare May 12, 2026 07:03

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

LGTM

@Kushal-deb
Kushal-deb self-requested a review May 12, 2026 09:16
@rkachach

Copy link
Copy Markdown
Contributor

@rkachach
rkachach merged commit e7e72d2 into ceph:main May 14, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/25860518725

IanEff added a commit to IanEff/ceph-csi that referenced this pull request Oct 1, 2026
CEPH_VERSION only selects the Ceph client packages in the cephcsi
image. The cluster that Rook deploys uses ROOK_CEPH_CLUSTER_IMAGE,
which was still v20 (Tentacle), so the mgr in CI kept running
20.2.4 without the mgr/nfs CephfsClient leak fix (ceph/ceph#68842).

Umbrella v21.1.1 includes that fix. Rook's cluster-test.yaml sets
allowUnsupported, so Rook v1.19.9 deploys v21 as-is.

Signed-off-by: Ian Furst <[email protected]>
@IanEff IanEff mentioned this pull request Oct 1, 2026
2 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants