Skip to content
Snippets Groups Projects
  • Kevin Wolf's avatar
    08fd2f30
    qcow2: Bring synchronous read/write back to life · 08fd2f30
    Kevin Wolf authored
    
    When the synchronous read and write functions were dropped, they were replaced
    by generic emulation functions. Unfortunately, these emulation functions don't
    provide the same semantics as the original functions did.
    
    The original bdrv_read would mean that we read some data synchronously and that
    we won't be interrupted during this read. The latter assumption is no longer
    true with the emulation function which needs to use qemu_aio_poll and therefore
    allows the callback of any other concurrent AIO request to be run during the
    read. Which in turn means that (meta)data read earlier could have changed and
    be invalid now. qcow2 is not prepared to work in this way and it's just scary
    how many places there are where other requests could run.
    
    I'm not sure yet where exactly it breaks, but you'll see breakage with virtio
    on qcow2 with a backing file. Providing synchronous functions again fixes the
    problem for me.
    
    Patchworks-ID: 35437
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
    (cherry picked from commit ef845c3b)
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
    08fd2f30
    History
    qcow2: Bring synchronous read/write back to life
    Kevin Wolf authored
    
    When the synchronous read and write functions were dropped, they were replaced
    by generic emulation functions. Unfortunately, these emulation functions don't
    provide the same semantics as the original functions did.
    
    The original bdrv_read would mean that we read some data synchronously and that
    we won't be interrupted during this read. The latter assumption is no longer
    true with the emulation function which needs to use qemu_aio_poll and therefore
    allows the callback of any other concurrent AIO request to be run during the
    read. Which in turn means that (meta)data read earlier could have changed and
    be invalid now. qcow2 is not prepared to work in this way and it's just scary
    how many places there are where other requests could run.
    
    I'm not sure yet where exactly it breaks, but you'll see breakage with virtio
    on qcow2 with a backing file. Providing synchronous functions again fixes the
    problem for me.
    
    Patchworks-ID: 35437
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
    (cherry picked from commit ef845c3b)
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>