Patchwork [07/15] ide: fix TRIM with empty range entry

login
register
mail settings
Submitter Stefan Hajnoczi
Date Jan. 15, 2013, 4:48 p.m.
Message ID <1358268511-27061-8-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/212278/
State New
Headers show

Comments

Stefan Hajnoczi - Jan. 15, 2013, 4:48 p.m.
From: Paolo Bonzini <pbonzini@redhat.com>

ATA-ACS-3 says "If the two byte range length is zero, then the LBA
Range Entry shall be discarded as padding."  iovecs are used as if
they are linearized, so it is incorrect to discard the rest of
this iovec.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/ide/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 6f1938a..cb77dfc 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -374,7 +374,7 @@  BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
             uint16_t count = entry >> 48;
 
             if (count == 0) {
-                break;
+                continue;
             }
 
             ret = bdrv_discard(bs, sector, count);