[PATCH 2/2] qemuSecurityChownCallback: Don't initialize storage file subsystem for local file

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

 



virStorageFileSupportsSecurityDriver ends up initializing the storage
file backend which after the recent changes to the daemon architecture
may end up dlopening of the backend modules.

Since this is required only for remote storage we can optimize the call
by moving the check whether the backend is supported to the branch which
deals with remote storage. This will prevent the pointless dlopen for
local files.

This is amplified by the fact that we now do most storage driver
operations in forks so the storage backends may not even be initialized
in the main daemon. On the other hand, not having gluster linked in the
main daemon is a big win, so we should keep only the forks having to
link with it.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b1f7be50b4..3cbd900f7e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -249,10 +249,6 @@ qemuSecurityChownCallback(const virStorageSource *src,
     int rv;
     g_autoptr(virStorageSource) cpy = NULL;

-    rv = virStorageFileSupportsSecurityDriver(src);
-    if (rv <= 0)
-        return rv;
-
     if (virStorageSourceIsLocalStorage(src)) {
         /* use direct chown for local files so that the file doesn't
          * need to be initialized */
@@ -273,6 +269,9 @@ qemuSecurityChownCallback(const virStorageSource *src,
         return 0;
     }

+    if ((rv = virStorageFileSupportsSecurityDriver(src)) <= 0)
+        return rv;
+
     if (!(cpy = virStorageSourceCopy(src, false)))
         return -1;

-- 
2.24.1





[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