On 03.03.2015 14:40, Peter Krempa wrote:
On Thu, Feb 26, 2015 at 15:17:33 +0100, Michal Privoznik wrote:
> So far, this is pure code replacement. But once we introduce
> reference counting to virNetworkObj this will be more handy as
> there'll be only one function to change: virNetworkObjEndAPI().
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> src/network/bridge_driver.c | 57 +++++++++++++++------------------------------
> 1 file changed, 19 insertions(+), 38 deletions(-)
In the qemu driver that is the inspiration for this change we always
pair the *EndAPI call with a *ObjFrom* ... in this case
networkObjFromNetwork.
I'd really appreciate if you could first scrub the code base of direct
lookup and use the networkObjFromNetwork helper instead so that we can
pair every EndAPI call with that.
ACK to this patch though. If you don't fancy cleaning the existing
places that manually lookup the object I can do it. Please let me know.
I've got such patch ready. However, the problem is lock ordering.
Currently, networkObjFromNetwork Locks the network driver lock, looks up
the network object and unlocks the network driver. However, some APIs
(in fact a lot of them) still rely on network driver locked. And I can't
just move the locking in those APIs, right? Because that way I'd try to
lock network driver with an object already locked. Therefore I saved the
cleanup patch that does exactly what you're requesting here for later.
Sorry.
Michal