Skip to content

pybind/cephfs, mgr/volumes: introduce non-recursive rmtree(), refactor purge() to use it and add MDS optimizations#63917

Merged
rishabh-d-dave merged 10 commits intoceph:mainfrom
rishabh-d-dave:vols-purge-trash-entry
Oct 7, 2025
Merged

pybind/cephfs, mgr/volumes: introduce non-recursive rmtree(), refactor purge() to use it and add MDS optimizations#63917
rishabh-d-dave merged 10 commits intoceph:mainfrom
rishabh-d-dave:vols-purge-trash-entry

Conversation

@rishabh-d-dave
Copy link
Contributor

@rishabh-d-dave rishabh-d-dave commented Jun 13, 2025

Method purge() in trash.py calls rmtree() which is recursive method. To
avoid Python's recurision limit, switch to non-recursive approach.

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

Also fixes https://tracker.ceph.com/issues/72779 and https://tracker.ceph.com/issues/72993.

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

@rishabh-d-dave rishabh-d-dave requested review from a team and vshankar June 13, 2025 07:31
@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch from c0c7904 to a658ebf Compare June 16, 2025 07:24
@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch 2 times, most recently from a1fe4a9 to 442c53b Compare June 17, 2025 08:29
@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch from 442c53b to b448c9a Compare June 17, 2025 16:59
@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch 2 times, most recently from 8a63efd to cbcf76e Compare June 18, 2025 16:00
Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

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

Add more error handling and refactor the code a bit.

@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch from 703b97e to 5284010 Compare June 20, 2025 15:07
@rishabh-d-dave
Copy link
Contributor Author

rishabh-d-dave commented Jun 20, 2025

@batrick I had some confusion regarding in the code suggested in last review cycle but I think I've got it sorted. I've also made some improvements along the way. PTAL, I'll mark previous review threads resolved based on next set of reviews.

The current PR branch has been tested for deletion of subvolumes of several kinds: ones with reg files, symlinks, dirs, retained snapshots, etc. All tests ran fine.

@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch 3 times, most recently from 8f9769c to c027653 Compare June 21, 2025 10:06
@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check arm64

Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

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

Please add code for tracking what kinds of errors were encountered so we can get useful diagnostics when debugging. This needs to be carried up the stack to the root when the operation completes (either successfully or not).

@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch 2 times, most recently from ed47679 to 7fc7853 Compare June 24, 2025 11:19
@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

@rishabh-d-dave
Copy link
Contributor Author

jenkins test api

@rishabh-d-dave
Copy link
Contributor Author

@batrick ping

@rishabh-d-dave rishabh-d-dave force-pushed the vols-purge-trash-entry branch 5 times, most recently from bb34476 to e697d47 Compare September 23, 2025 13:14
Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

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

nearly there!

Generating full absolute path for inodes for printing in MDS logs slows
down the FS to a great extent especially when the path is very long
(imagine a path with 2000 components). Also printing such long paths in
MDS logs is not only pointless but also greatly reduces the readability
of the MDS logs.

Therefore, generate only 10 final components of inode paths for logging.

Fixes: https://tracker.ceph.com/issues/72779
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Generating full absolute path for dentries for printing in MDS logs
slows the down the FS to a great extent especially when the path is very
long (imagine a path with 2000 components). Printing such long paths in
MDS logs is not only pointless but also greatly reduces the readability
of MDS logs.

Therefore, generate only 10 final components of the dentry paths for logging.

Fixes: https://tracker.ceph.com/issues/72779
Signed-off-by: Rishabh Dave <ridave@redhat.com>
@rishabh-d-dave
Copy link
Contributor Author

.

@rishabh-d-dave
Copy link
Contributor Author

jenkins test make check

Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

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

Otherwise, LGTM. Remaining nits can be addressed with filepath refactor.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
Path can be virtually infinitely long and logging a long long path
(imagine around 2000 path components) is un-useful as well as lowers
readability of the log. Therefore, trim before logging.

Fixes: https://tracker.ceph.com/issues/72993
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

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

Again, please have @vshankar also take a look.

@rishabh-d-dave
Copy link
Contributor Author

@vshankar mentioned that he's too occupied with other and therefore can't get to this anytime soon. Checked with @batrick regarding this, it's fine to initiate QA.

@rishabh-d-dave
Copy link
Contributor Author

This PR is under test in https://tracker.ceph.com/issues/73356.

@rishabh-d-dave
Copy link
Contributor Author

This PR is under test in https://tracker.ceph.com/issues/73357.

Copy link
Contributor Author

@rishabh-d-dave rishabh-d-dave left a comment

Choose a reason for hiding this comment

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

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.

2 participants