From: Peter Krempa Date: Thu, 26 Mar 2020 09:49:11 +0000 (+0100) Subject: qemuSecurityChownCallback: Don't initialize storage file subsystem for local file X-Git-Tag: v6.3.0-rc1~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=496a44a7ebc09746600830055ea3dfc806acb35d;p=thirdparty%2Flibvirt.git qemuSecurityChownCallback: Don't initialize storage file subsystem for local file 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 Reviewed-by: Pavel Mores --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3d944d2713..daa3cb397d 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;