]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vircgroupv2devices: fix counting entries in BPF map
authorPavel Hrdina <phrdina@redhat.com>
Tue, 11 Aug 2020 09:07:06 +0000 (11:07 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 11 Aug 2020 13:11:15 +0000 (15:11 +0200)
commit7e574d1a079bd13aeeedb7024cc45f85b1843fcc
treeef18ba6d5e00b15b8ffd7efc06a04752bb5351d8
parent4ae4e991e0d7f2b815752c7ff5666b0e928bae78
vircgroupv2devices: fix counting entries in BPF map

BPF syscall BPF_MAP_GET_NEXT_KEY returns -1 if something fails but it
will also return -1 if trying to get next key using the last key in the
map with errno set to ENOENT.

If there are VMs running and libvirtd is restarted and user tries to
call some cgroup devices operation on a VM we need to get the count of
entries in BPF map and it fails which will result in error when trying
to attach/detech devices.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1833321

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/util/vircgroupv2devices.c