[libvirt PATCH] qemu: Do not try to set memlock on inactive domain

Jiri Denemark jdenemar at redhat.com
Wed Aug 3 11:52:41 UTC 2022


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 <jdenemar at redhat.com>
---
 src/qemu/qemu_domain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 12c58a25b9..ad6c614d89 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9461,6 +9461,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, &current) < 0)
         return -1;
 
-- 
2.35.1



More information about the libvir-list mailing list