Skip to content

librbd: propagate ENOENT for non-existent groups and images - #70086

Merged
idryomov merged 1 commit into
ceph:mainfrom
VinayBhaskar-V:wip-group-image-list
Jul 31, 2026
Merged

idryomov merged 1 commit into
ceph:mainfrom
VinayBhaskar-V:wip-group-image-list

Conversation

@VinayBhaskar-V

@VinayBhaskar-V VinayBhaskar-V commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Calling list_images() on a non-existent group falsely succeeded and returned an empty iterator.This happened because Group<I>::image_list ignored the negative error code returned by group_image_list, allowing
execution to proceed blindly. Furthermore, the C API rbd_group_image_list intercepted -ENOENT and forced a success (0) return value.

Similarly other public C APIs rbd_snap_list and rbd_group_snap_list also intercepts -ENOENT and forces a success (0) return value which is incorrect.

Fix these behavior by:

  • Propagating errors properly inside Group<I>::image_list.
  • Removing the incorrect -ENOENT masking in rbd_group_image_list, rbd_snap_list, rbd_group_snap_list`

Now list_images() consistently raise an ObjectNotFound error when nvoked on a non-existent group and public C APIs propagate ENOENT without masking it into 0.
Also Extended the TestGroups test fixture with self.dne_group to validate the expected error paths across all relevant APIs.

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

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.

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

  • This is going to need to need a release note in PendingReleaseNotes -- append something starting with RBD: at the end of >=20.0.0 section.
  • Since this touches the C API, let's make sure the change is covered in src/test/librbd/test_Groups.cc.

Comment thread src/librbd/librbd.cc Resolved
@VinayBhaskar-V VinayBhaskar-V changed the title pybind/rbd: handle non-existent groups properly in list_images() librbd: propagate ENOENT for non-existent groups and images Jul 10, 2026
Comment thread src/test/librbd/test_Groups.cc Resolved
@github-actions

Copy link
Copy Markdown

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

@ajarr
ajarr requested a review from idryomov July 20, 2026 16:06
Comment thread PendingReleaseNotes Resolved
Comment thread src/test/librbd/test_Groups.cc Resolved
Comment thread src/test/librbd/test_Groups.cc Resolved
Comment thread src/test/pybind/test_rbd.py Resolved
Comment thread src/test/pybind/test_rbd.py Resolved
Comment thread src/test/pybind/test_rbd.py Resolved
Comment thread src/pybind/rbd/rbd.pyx Resolved
@github-actions

Copy link
Copy Markdown

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

Comment thread PendingReleaseNotes Resolved
Comment thread PendingReleaseNotes Resolved
Comment thread PendingReleaseNotes Resolved
Comment thread src/test/librbd/test_Groups.cc Resolved
Calling `list_images()` on a non-existent group falsely succeeded and
returned an empty iterator.This happened because `Group<I>::image_list`
ignored the negative error code returned by `group_image_list`, allowing
execution to proceed blindly. Furthermore, the C API `rbd_group_image_list`
intercepted `-ENOENT` and forced a success (0) return value.

Similarly other public C APIs `rbd_snap_list` and `rbd_group_snap_list`
also intercepts -ENOENT and forces a success (0) return value which
is incorrect.

Fix these behavior by:
- Propagating errors properly inside `Group<I>::image_list`.
- Removing the incorrect `-ENOENT` masking in `rbd_group_image_list`,
`rbd_snap_list`, rbd_group_snap_list`

Now `list_images()` consistently raise an `ObjectNotFound` error when
invoked on a non-existent group and public C APIs propagate ENOENT
without masking it into 0.
Also Extended the `TestGroups` test fixture with `self.dne_group` to
validate the expected error paths across all relevant APIs.

Fixes: https://tracker.ceph.com/issues/78108
Signed-off-by: VinayBhaskar-V <[email protected]>
@idryomov
idryomov merged commit b1c466c into ceph:main Jul 31, 2026
6 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