Skip to contentSkip to conversation

kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl

PATCH New Michael Tokarev 1 participant 1 message Apr 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl

ENOENT means the kernel has an empty dirty bitmap for this slot. Don't abort in that case. This appears to solve the bug reported at

https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1303926

which first showed up with commit b533f658a98325d: fix return check for KVM_GET_DIRTY_LOG ioctl

---
 kvm-all.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

mjt:
This is a bit less intrusive approach (having in mind we're this far into the release process) than my version, and it makes the code closer to original unpatched (before b533f658a98325d) version.

kvm-all.c +4 -1
index cd4111d..7b7ea8d 100644
@@ -441,10 +441,13 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
 
         d.slot = mem->slot;
 
-        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
+        ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
+        if (ret < 0 && ret != -ENOENT) {
             DPRINTF("ioctl failed %d\n", errno);
             ret = -1;
             break;
+        } else if (ret < 0) {
+            ret = 0;
         }
 
         kvm_get_dirty_pages_log_range(section, d.dirty_bitmap);
Signature · 1 line
1.7.10.4