Skip to content
  • Jeff Cody's avatar
    7479bf07
    block/vhdx.c: Don't blindly update the header · 7479bf07
    Jeff Cody authored
    
    
    The VHDX specification requires that before user data modification of
    the vhdx image, the VHDX header file and data GUIDs need to be updated.
    In vhdx_open(), if the image is set to RDWR, we go ahead and update the
    header.
    
    However, just because the image is set to RDWR does not mean we can go
    ahead and write at this point - specifically, if the QEMU run state is
    INMIGRATE, the underlying file BS may be set to inactive via the BDS
    open flag of BDRV_O_INACTIVE.  Attempting to write under this condition
    will cause an assert in bdrv_co_pwritev().
    
    We can alternatively latch the first time the image is written.  And lo
    and behold, we do just that, via vhdx_user_visible_write() in
    vhdx_co_writev().  This means the call to vhdx_update_headers() in
    vhdx_open() is likely just vestigial, and can be removed.
    
    Reported-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Tested-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
    Message-id: 659e4cdba6ef4c651737852777c8c93d27b38040.1510059970.git.jcody@redhat.com
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarDenis V. Lunev <den@openvz.org>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
    7479bf07
    block/vhdx.c: Don't blindly update the header
    Jeff Cody authored
    
    
    The VHDX specification requires that before user data modification of
    the vhdx image, the VHDX header file and data GUIDs need to be updated.
    In vhdx_open(), if the image is set to RDWR, we go ahead and update the
    header.
    
    However, just because the image is set to RDWR does not mean we can go
    ahead and write at this point - specifically, if the QEMU run state is
    INMIGRATE, the underlying file BS may be set to inactive via the BDS
    open flag of BDRV_O_INACTIVE.  Attempting to write under this condition
    will cause an assert in bdrv_co_pwritev().
    
    We can alternatively latch the first time the image is written.  And lo
    and behold, we do just that, via vhdx_user_visible_write() in
    vhdx_co_writev().  This means the call to vhdx_update_headers() in
    vhdx_open() is likely just vestigial, and can be removed.
    
    Reported-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Tested-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
    Message-id: 659e4cdba6ef4c651737852777c8c93d27b38040.1510059970.git.jcody@redhat.com
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: default avatarDenis V. Lunev <den@openvz.org>
    Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Loading