On Thu, Jun 05, 2014 at 07:33:15PM +0200, Maros Zatko wrote:
First I've put recursive mutex into handle. This worked.
Next, due to previous discussion about this recursive manner, I've
tried it with ordinary ones.
This doesn't work. make check hangs on tests/qemu, other tests try
to double acquire lock and hangs,
same goes with guestfish. I found interesting that you can run
guestfish, add a disk but you can't launch it.
Unless you set LIBGUESTFS_DEBUG or TRACE flag then it hangs immediately :)
Do we want to have it recursive or investigate more for exact races
and have fine grained locking?
Ideas?
This is expected, and is not due to a race.
Libguestfs APIs call into themselves all over the place. In order for
a non-recursive lock to work, you will have to modify the generator so
that it creates another level of functions beyond the current set:
guestfs_foo # the public API
guestfs__foo # internal API, without tracing
guestfs___foo # IIRC non-daemon function impls
Actually I forget how precisely this works now and I don't have access
to the source code to check.
Anyway once the generator is thus modified (to add a tracing but
non-locking layer of functions just below the public API and above the
"__" layer), change all recursive internal libguestfs-to-libguestfs
calls to use this new layer.
Another point that could be tidied up here: Using double (or triple)
underscores in identifiers is apparently contrary to the C++ standard.
It doesn't cause any problems at the moment, but it's not exactly
elegant and it's hard to read. I'm sure you're not keen to see
quadruple underscores in your patch either. So a better way to name
these internal levels of functions.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/