[libvirt PATCH 09/11] storage: Statically initialize mutex

Daniel P. Berrangé berrange at redhat.com
Tue Feb 22 14:28:43 UTC 2022


On Tue, Feb 22, 2022 at 03:10:52PM +0100, Tim Wiederhake wrote:
> On Thu, 2022-02-17 at 13:15 +0000, Daniel P. Berrangé wrote:
> > On Thu, Feb 17, 2022 at 02:01:01PM +0100, Tim Wiederhake wrote:
> > 
> > Really should be giving an explanation of why this change
> > is required.
> > 
> Added locally to commit message:
> 
>   Making the mutex static and independent of the lifetime of the
>   driver object allows for simplification of mutex handling during
>   the object's initialization and cleanup using VIR_LOCK_GUARD's
>   unlock-on-scope-exit behavior.

Note, the locking during init/cleanup is pointless because we
rely on serialization and a mere mutex doesn't give us safety
in cleanup, as any concurrent thread will be accessing a freed
driver anyway. I guess that's pre-existing issue though.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list