Skip to content

pybind/rbd: reset element count on iterator errors - #70755

Merged
idryomov merged 2 commits into
ceph:mainfrom
ajarr:wip-reset-element-count-on-errors
Aug 23, 2026
Merged

idryomov merged 2 commits into
ceph:mainfrom
ajarr:wip-reset-element-count-on-errors

Conversation

@ajarr

@ajarr ajarr commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Reset the element count to zero in the iterator classes when a C API listing call fails. This ensures that the corresponding cleanup C API is invoked with the correct number of initialized elements if an exception is raised.

Previously, the iterator retained the requested element count on error, allowing the cleanup C API to process entries that were never initialized. This happens to be harmless today because the C APIs zero-initialize the allocated arrays with memset, but the cleanup logic should not rely on that implementation detail.

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

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.

Reset the element count to zero in the iterator classes when a C API
listing call fails. This ensures that the corresponding cleanup C API
is invoked with the correct number of initialized elements if an
exception is raised.

Previously, the iterator retained the requested element count on error,
allowing the cleanup C API to process entries that were never
initialized. This happens to be harmless today because the C APIs
zero-initialize the allocated arrays with memset, but the cleanup
logic should not rely on that implementation detail.

Fixes: https://tracker.ceph.com/issues/78937
Signed-off-by: Ramana Raja <[email protected]>
Co-authored-by: VinayBhaskar-V <[email protected]>
@ajarr
ajarr requested a review from idryomov August 3, 2026 12:11
@ajarr

ajarr commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

Comment thread src/pybind/rbd/rbd.pyx Resolved
Comment thread src/pybind/rbd/rbd.pyx Resolved
Comment thread src/pybind/rbd/rbd.pyx Resolved
Comment thread src/pybind/rbd/rbd.pyx Resolved
- In ImageIterator, follow the established ERANGE retry pattern when
  listing images.
- Add missing trash image sources.
- In TrashIterator, guard `rbd_trash_list_cleanup()` against a
  NULL trash `entries` pointer.
- In TrashIterator, remove the redundant trash entry count assignment.

Signed-off-by: Ramana Raja <[email protected]>
@idryomov
idryomov merged commit bc971c0 into ceph:main Aug 23, 2026
7 checks passed
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.

3 participants