diff mbox

[for-2.0] Revert "fix return check for KVM_GET_DIRTY_LOG ioctl"

Message ID 1397477644-902-1-git-send-email-mjt@msgid.tls.msk.ru
State New
Headers show

Commit Message

Michael Tokarev April 14, 2014, 12:14 p.m. UTC
This reverts commit b533f658a98325d0e47b36113bd9f5bcc046fdae.

The original code was wrong, because effectively it ignored errors
from kernel, because kernel does not return -1 on error case but
returns -errno, and does not return -EPERM for this particular ioctl.
But in some cases kernel actually returned unsuccessful result,
namely, when the dirty bitmap in requested slot does not exist
it returns -ENOENT.  With new code this condition becomes an
error when it shouldn't be.

Revert that patch instead of fixing it properly this late in the
release process.  I disagree with this approach, but let's make
things move _somewhere_, instead of arguing endlessly whch of
the 2 proposed fixes is better.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 kvm-all.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell April 14, 2014, 3:03 p.m. UTC | #1
On 14 April 2014 13:14, Michael Tokarev <mjt@tls.msk.ru> wrote:
> This reverts commit b533f658a98325d0e47b36113bd9f5bcc046fdae.
>
> The original code was wrong, because effectively it ignored errors
> from kernel, because kernel does not return -1 on error case but
> returns -errno, and does not return -EPERM for this particular ioctl.
> But in some cases kernel actually returned unsuccessful result,
> namely, when the dirty bitmap in requested slot does not exist
> it returns -ENOENT.  With new code this condition becomes an
> error when it shouldn't be.
>
> Revert that patch instead of fixing it properly this late in the
> release process.  I disagree with this approach, but let's make
> things move _somewhere_, instead of arguing endlessly whch of
> the 2 proposed fixes is better.
>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

Applied, thanks.

-- PMM
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index cd4111d..82a9119 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -441,7 +441,7 @@  static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
 
         d.slot = mem->slot;
 
-        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
+        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
             DPRINTF("ioctl failed %d\n", errno);
             ret = -1;
             break;