]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: don't check for parallel iteration in hash-related functions
authorVincent Bernat <vincent@bernat.im>
Tue, 10 Apr 2018 06:27:15 +0000 (08:27 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 11 Apr 2018 09:18:37 +0000 (11:18 +0200)
commit4d7384eb9ddef2008cb0cc165eb808f74bc83d6b
treed4ae8a574363d77d12c4a447cb0760cc91180b0f
parenta3b1ee055fd63eff025205b21785e12d6d9c7632
util: don't check for parallel iteration in hash-related functions

This is the responsability of the caller to apply the correct lock
before using these functions. Moreover, the use of a simple boolean
was still racy: two threads may check the boolean and "lock" it
simultaneously.

Users of functions from src/util/virhash.c have to be checked for
correctness. Lookups and iteration should hold a RO
lock. Modifications should hold a RW lock.

Most important uses seem to be covered. Callers have now a greater
responsability, notably the ability to execute some operations while
iterating were reliably forbidden before are now accepted.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
src/util/virhash.c
tests/virhashtest.c