]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/rbd: handle non-existent groups properly in list_snaps() 70039/head
authorVinayBhaskar-V <vvarada@redhat.com>
Thu, 9 Jul 2026 16:00:26 +0000 (21:30 +0530)
committerVinayBhaskar-V <vvarada@redhat.com>
Thu, 9 Jul 2026 16:16:21 +0000 (21:46 +0530)
commit56bcf706cf91f0734899ae9de378c459a9b5af50
treed525e3a627b977ac73e27cb17aa1e05b29115e24
parent27060dccdf1cf9fd5958e0d78d1c0565a3bc4439
pybind/rbd: handle non-existent groups properly in list_snaps()

Calling `list_snaps()` on a non-existent group crashed the entire
Python process with a `free(): invalid pointer` error. This happened
because an unexpected `-ENOENT` error returned by `rbd_group_snap_list2`
and the exception was raised without updating the num_group_snaps to 0
from 10. Later the Cython `__dealloc__` wrapper attempted to free garbage
of uninitialized pointer spaces resulting in a crash.

Fix this behavior by resetting `self.num_group_snaps` to 0 inside
`GroupSnapIterator` before raising exception to prevent memory
corruption and accessing uninitialized pointers during cleanup call

Now `list_snaps()` consistently raise an `ObjectNotFound` error when
invoked on a non-existent group.
Also Extended the `TestGroups` test fixture with `self.dne_group` to
validate the expected error path for `list_snaps()`.

Fixes: https://tracker.ceph.com/issues/78034
Signed-off-by: VinayBhaskar-V <vvarada@redhat.com>
src/pybind/rbd/rbd.pyx
src/test/pybind/test_rbd.py