Received: from eggs.gnu.org ([2001:4830:134:3::10]:52840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYtiI-0005QN-Lk for qemu-devel@nongnu.org; Sat, 12 Apr 2014 04:55:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYtiE-0003zq-Bq for qemu-devel@nongnu.org; Sat, 12 Apr 2014 04:55:02 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:35792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYtiE-0003zm-49 for qemu-devel@nongnu.org; Sat, 12 Apr 2014 04:54:58 -0400 From: Michael Tokarev Date: Sat, 12 Apr 2014 12:54:54 +0400 Message-Id: <1397292894-30166-1-git-send-email-mjt@msgid.tls.msk.ru> Subject: [Qemu-devel] [PATCH] kvm_physical_sync_dirty_bitmap: ignore ENOENT from kvm_vm_ioctl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Serge Hallyn , Michael Tokarev , Mario Smarduch 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 Signed-off-by: Serge Hallyn Signed-off-by: Michael Tokarev --- 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. diff --git a/kvm-all.c b/kvm-all.c index cd4111d..7b7ea8d 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -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); -- 1.7.10.4