From: Jiri Denemark Date: Wed, 3 Aug 2022 11:25:06 +0000 (+0200) Subject: qemu: Do not try to set memlock on inactive domain X-Git-Tag: v8.7.0-rc1~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc8538157ba39cffddf29c0ea6983896720c3089;p=thirdparty%2Flibvirt.git qemu: Do not try to set memlock on inactive domain When we call qemuDomainSetMaxMemLock to reset memory locking limit back to its original value the domain can already be stopped (for example after the domain shuts down during migration) in which case it does not make sense to set any limit. Doing so can even be harmful as we may end up setting the limit for the daemon itself as the PID is 0. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dd8a295f0d..69e0c9e217 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9405,6 +9405,10 @@ qemuDomainSetMaxMemLock(virDomainObj *vm, { unsigned long long current = 0; + /* nothing to do if the domain is not running */ + if (vm->pid <= 0) + return 0; + if (virProcessGetMaxMemLock(vm->pid, ¤t) < 0) return -1;