]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuSecurityChownCallback: Don't initialize storage file subsystem for local file
authorPeter Krempa <pkrempa@redhat.com>
Thu, 26 Mar 2020 09:49:11 +0000 (10:49 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 3 Apr 2020 07:32:51 +0000 (09:32 +0200)
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.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
src/qemu/qemu_driver.c

index 3d944d27130b74bcdb64cd9ac5d7da6315a632ce..daa3cb397d1e3d13a1114226249732bea5f46a13 100644 (file)
@@ -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;