[libvirt PATCH 1/5] nwfilter: stop using recursive mutex for IP learning

Daniel P. Berrangé berrange at redhat.com
Fri Feb 25 15:30:49 UTC 2022


The virNWFilterLockIface method is only called from one place,
the learnIPAddressThread method. This is the entry point for
the learning thread on the interface in question. As such
there is never any recursive locking on this mutex from the
same thread. This appears to have been the case since the
code was first introduced. Thus a plain mutex is sufficient.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/nwfilter/nwfilter_learnipaddr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index fb552bd1e6..4840b0539f 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -151,7 +151,7 @@ virNWFilterLockIface(const char *ifname)
     if (!ifaceLock) {
         ifaceLock = g_new0(virNWFilterIfaceLock, 1);
 
-        if (virMutexInitRecursive(&ifaceLock->lock) < 0) {
+        if (virMutexInit(&ifaceLock->lock) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("mutex initialization failed"));
             g_free(ifaceLock);
-- 
2.35.1




More information about the libvir-list mailing list