Skip to content
  • Eric Blake's avatar
    30065d14
    qemu-img: Gracefully shutdown when map can't finish · 30065d14
    Eric Blake authored
    
    
    Trying 'qemu-img map -f raw nbd://localhost:10809' causes the
    NBD server to output a scary message:
    
    qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
    
    This is because the NBD client, being remote, has no way to expose a
    human-readable map (the --output=json data is fine, however). But
    because we exit(1) right after the message, causing the client to
    bypass all block cleanup, the server sees the abrupt exit and warns,
    whereas it would be silent had the client had a chance to send
    NBD_CMD_DISC. Other protocols may have similar cleanup issues, where
    failure to blk_unref() could cause unintended effects.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20190326184043.7544-1-eblake@redhat.com>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    30065d14
    qemu-img: Gracefully shutdown when map can't finish
    Eric Blake authored
    
    
    Trying 'qemu-img map -f raw nbd://localhost:10809' causes the
    NBD server to output a scary message:
    
    qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
    
    This is because the NBD client, being remote, has no way to expose a
    human-readable map (the --output=json data is fine, however). But
    because we exit(1) right after the message, causing the client to
    bypass all block cleanup, the server sees the abrupt exit and warns,
    whereas it would be silent had the client had a chance to send
    NBD_CMD_DISC. Other protocols may have similar cleanup issues, where
    failure to blk_unref() could cause unintended effects.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20190326184043.7544-1-eblake@redhat.com>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading