[PATCH v2 07/20] node_device_udev: Don't take `mdevctlLock` for `mdevctl list` and add comments about locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit a99d876a0f58 ("node_device: Use automatic mutex management") replaced the
locking mechanism and accidentally removed the comment with the reason why the
lock is taken. The reason was to "ensure only a single thread can query mdevctl
at a time", but this reason is no longer valid or maybe it never was. Therefore,
let's remove this lock and add a comment to `mdevCtl` what it protects.

Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
---
 src/node_device/node_device_udev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 616f98885a60..c2e6c593709b 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -72,8 +72,9 @@ struct _udevEventData {
     /* init thread */
     virThread *initThread;
 
-    GList *mdevctlMonitors;
+    /* Protects @mdevctlMonitors */
     virMutex mdevctlLock;
+    GList *mdevctlMonitors;
     int mdevctlTimeout;
 };
 
@@ -2069,9 +2070,6 @@ udevPCITranslateInit(bool privileged G_GNUC_UNUSED)
 static void
 mdevctlUpdateThreadFunc(void *opaque G_GNUC_UNUSED)
 {
-    udevEventData *priv = driver->privateData;
-    VIR_LOCK_GUARD lock = virLockGuardLock(&priv->mdevctlLock);
-
     if (nodeDeviceUpdateMediatedDevices() < 0)
         VIR_WARN("mdevctl failed to update mediated devices");
 }
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux