[libvirt PATCH 6/7] virMutex*: Warn on error

Peter Krempa pkrempa at redhat.com
Thu Aug 5 15:29:24 UTC 2021


On Thu, Aug 05, 2021 at 16:11:15 +0100, Daniel P. Berrangé wrote:
> On Thu, Aug 05, 2021 at 02:58:03PM +0100, Daniel P. Berrangé wrote:
> > On Thu, Aug 05, 2021 at 03:33:57PM +0200, Tim Wiederhake wrote:
> > > On Thu, 2021-08-05 at 14:24 +0100, Daniel P. Berrangé wrote:
> > > > On Thu, Aug 05, 2021 at 03:08:50PM +0200, Tim Wiederhake wrote:

[...]

> The pthread_mutex_destroy call is the only one that I see
> returning errors with PTHREAD_MUTEX_NORMAL. So I don't think
> there's benefit to adding the code to lock/unlock paths.

And as noted I'd be very careful with that one too. I've got at least
one counterexample of a code path which effectively does the same on a
very common code path.

Namely 'virDomainObjParseXML' uses:

g_autoptr(virDomainObj) obj = NULL;

and then returns directly on common failures such as XML parsing errors,
post-parse callback errors or even errors from the validation callbacks.

Spamming logs in such a common code path is definitely not acceptable.





More information about the libvir-list mailing list