[PATCH 1/6] ch_driver: Don't lock driver when getting version

Michal Privoznik mprivozn at redhat.com
Thu Feb 10 15:51:29 UTC 2022


In chConnectGetVersion() the CH driver is locked in order to read
driver->version. This is needless, because not only is the
version set with driver unlocked (chStateInitialize() calls
chExtractVersion() which sets the version), but the version is
practically immutable. Once driver initialized itself it's never
changed.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/ch/ch_driver.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index e751ddba19..7c3b45ca2f 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -106,9 +106,7 @@ static int chConnectGetVersion(virConnectPtr conn,
     if (virConnectGetVersionEnsureACL(conn) < 0)
         return -1;
 
-    chDriverLock(driver);
     *version = driver->version;
-    chDriverUnlock(driver);
     return 0;
 }
 
-- 
2.34.1




More information about the libvir-list mailing list