On Thu, Mar 05, 2015 at 12:05:24 +0100, Michal Privoznik wrote: > This patch alone does not make much sense, I know. But it > prepares ground for next patch which when looking up a network in > the object list will not lock each network separately when > accessing its definition. Therefore we must have all the places > changing network definition lock the list. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/conf/network_conf.c | 9 ++++++++- > src/conf/network_conf.h | 3 ++- > src/network/bridge_driver.c | 4 ++-- > 3 files changed, 12 insertions(+), 4 deletions(-) > > diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c > index 3d318ce..007cebb 100644 > --- a/src/conf/network_conf.c > +++ b/src/conf/network_conf.c > @@ -537,12 +537,19 @@ virNetworkObjSetDefTransient(virNetworkObjPtr network, bool live) > * This *undoes* what virNetworkObjSetDefTransient did. > */ > void I've looked through the next patch and you are basically trying to make the name and UUID pointers for domain immutable or at leas write locked ... > -virNetworkObjUnsetDefTransient(virNetworkObjPtr network) > +virNetworkObjUnsetDefTransient(virNetworkObjListPtr nets, > + virNetworkObjPtr network) > { > if (network->newDef) { > + virObjectRef(network); > + virObjectUnlock(network); > + virObjectLock(nets); > + virObjectLock(network); > + virObjectUnref(network); But I don't really like pulling in the complexity into this helper. > virNetworkDefFree(network->def); > network->def = network->newDef; > network->newDef = NULL; > + virObjectUnlock(nets); > } > } While I like the idea, I'd rather see a conversion to R/W locks or making of the name and UUID pointers immutable than this hack. Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list