Skip to content

mgr/volumes: use depth-first, non-recursive approach for cloning - #64774

Merged
vshankar merged 25 commits into
ceph:mainfrom
rishabh-d-dave:vols-non-recursive-cptree
May 14, 2026
Merged

vshankar merged 25 commits into
ceph:mainfrom
rishabh-d-dave:vols-non-recursive-cptree

Conversation

@rishabh-d-dave

Copy link
Copy Markdown
Contributor

Switch to non-recursive approach in cptree() (located in bulk_copy() in
async_cloner.py) to prevent it from crashing with "RecursionError:
maximum recursion depth exceeded".

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

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 batrick July 31, 2025 13:05
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@batrick I've separate code for cptree() from rmtree() code/PR. PTAL and let me know if this is going in the right direction.

@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch from d49b0c8 to 49ade73 Compare July 31, 2025 18:49
Comment thread src/pybind/cephfs/cephfs.pyx Resolved
@github-actions

github-actions Bot commented Oct 7, 2025

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch from 49ade73 to 5650531 Compare October 8, 2025 06:06
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins retest this please

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test docs

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@batrick It would be great if you can confirm that this PR is moving in the right direction before I proceed further.

@rishabh-d-dave rishabh-d-dave changed the title mgr/volumes: use depth-first, non-recursive apporach for cloning mgr/volumes: use depth-first, non-recursive approach for cloning Oct 8, 2025

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly to your other PR, I want to see createat, etc. going forward. It's a better way to structure this recursive operation.

@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch from 5650531 to 102374a Compare October 21, 2025 12:14
@github-actions github-actions Bot added the tests label Oct 21, 2025
@rishabh-d-dave

rishabh-d-dave commented Oct 21, 2025 •

Copy link
Copy Markdown
Contributor Author

@batrick PTAL. Tthe cptree code is running fine against all the tests but "at" functions are not being used yet. I'll make that change in next push. Please let me know if rest of the PR looks okay in the mean time.

Comment thread src/pybind/cephfs/cephfs.pyx Resolved
Comment thread src/pybind/cephfs/cephfs.pyx Resolved
Comment thread src/pybind/cephfs/cephfs.pyx Resolved
@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch 2 times, most recently from 1c3dbfa to 32abf2a Compare October 30, 2025 11:46
@rishabh-d-dave

rishabh-d-dave commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor Author

@batrick ping

Code for non-recursive cptree is working fine, except this review comment all the others have been incorporarted). Tests are also running successfully. Please review and give me an ACK, if functionally everything looks fine. If it looks fine, I'll proceed to add python bindings for "at" function and replace current functions to use them instead.

@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch 2 times, most recently from 01f5c5c to 9c6d067 Compare November 5, 2025 15:36
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

.

@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch 2 times, most recently from 4fd1531 to 5dac3e7 Compare November 6, 2025 14:30
Switch to non-recursive approach in cptree() (located in bulk_copy() in
async_cloner.py) to prevent it from crashing with "RecursionError:
maximum recursion depth exceeded".

Fixes: https://tracker.ceph.com/issues/72357
Signed-off-by: Rishabh Dave <[email protected]>
Make it optional to pass a function reference for should_cancel
parameter of rmtree function by defining a default value for it. Right
now one has to pass a simple lambda function returning False if one
wants to make rmtree operation uninterruptible -

rmtree('some-dir', should_cancel=lambda: False)

With should_cancel's default value set to "lambda: False", the call is
much simplied -

rmtree('some-dir')

Fixes: https://tracker.ceph.com/issues/75926
Signed-off-by: Rishabh Dave <[email protected]>
Don't attempt to unlink '/' as part of recursive delete when rmtree('/')
is called as it is an invalid op.

Fixes: https://tracker.ceph.com/issues/75924
Signed-off-by: Rishabh Dave <[email protected]>
Use rmtree() instead of purge_dir() for following 2 reasons -

1. purge_dir()'s recursive nature makes it vulnerable to max recursion
   limit.
2. It is redundant to have purge_dir() helper method since rmtree()
   already performs job in a better way.

Signed-off-by: Rishabh Dave <[email protected]>
@rishabh-d-dave
rishabh-d-dave force-pushed the vols-non-recursive-cptree branch from 7aae3e6 to f2a0e30 Compare April 16, 2026 12:41
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test docs

@vshankar

Copy link
Copy Markdown
Contributor

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

@vshankar
vshankar dismissed batrick’s stale review May 13, 2026 05:02

Comments addressed.

@vshankar
vshankar merged commit 20eb15f 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/25852589558

@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/25852589558

@github-actions

Copy link
Copy Markdown

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

I found one or more Fixes: tags in the commit messages in

git log 20eb15fb6d166ab33e8cc289e30e8b2aaeb5dbf8^..20eb15fb6d166ab33e8cc289e30e8b2aaeb5dbf8

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

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

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.

6 participants