Skip to content
  • Liu Yuan's avatar
    sheepdog: fix dynamic grow for running qcow2 format · e50d7607
    Liu Yuan authored
    
    
    When running qcow2 over sheepdog, we might meet following problem
    
      qemu-system-x86_64: shrinking is not supported
    
    And cause IO errors to Guest. This is because we abuse bs->total_sectors, which
    is manipulated by generic block layer and race with sheepdog code.
    
    We should directly check if offset > vdi_size to dynamically enlarge the volume
    instead of 'offset > bs->total_sectors', which will cause problem when following
    case happens:
    
       vdi_size > offset > bs->total_sectors
    
       # then trigger sd_truncate() to shrink the volume wrongly.
    
    Cc: qemu-devel@nongnu.org
    Cc: Kevin Wolf <kwolf@redhat.com>
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Reported-by: default avatarHadrien KOHL <hadrien.kohl@gmail.com>
    Signed-off-by: default avatarLiu Yuan <namei.unix@gmail.com>
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    e50d7607