]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: propagate ENOENT for non-existent groups and images 70086/head
authorVinayBhaskar-V <vvarada@redhat.com>
Thu, 9 Jul 2026 16:40:06 +0000 (22:10 +0530)
committerVinayBhaskar-V <vvarada@redhat.com>
Wed, 29 Jul 2026 13:41:14 +0000 (19:11 +0530)
commitc4c937d81c228c0f242ad4e8478064bafd4281c0
tree511877bcb5d82dd67671345e676683b1897a3661
parente677c76f12a162ed11f5953385efb0cc68bbf0dc
librbd: propagate ENOENT for non-existent groups and images

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 <vvarada@redhat.com>
PendingReleaseNotes
src/librbd/api/Group.cc
src/librbd/librbd.cc
src/test/librbd/test_Groups.cc
src/test/pybind/test_rbd.py