Skip to content
  • Kevin Wolf's avatar
    0b9e918f
    fdc: Fix inserting read-only media in empty drive · 0b9e918f
    Kevin Wolf authored
    
    
    In order to insert a read-only medium (i.e. a read-only block node) to
    the BlockBackend of a floppy drive, we must not have taken write
    permissions on that BlockBackend, or the operation will fail with the
    error message "Block node is read-only".
    
    The device already takes care to remove all permissions when the medium
    is ejected, but the state isn't correct if the drive is initially empty:
    It uses blk_is_read_only() to check whether write permissions should be
    taken, but this function returns false for empty BlockBackends in the
    common case.
    
    Fix floppy_drive_realize() to avoid taking write permissions if the
    drive is empty.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    0b9e918f
    fdc: Fix inserting read-only media in empty drive
    Kevin Wolf authored
    
    
    In order to insert a read-only medium (i.e. a read-only block node) to
    the BlockBackend of a floppy drive, we must not have taken write
    permissions on that BlockBackend, or the operation will fail with the
    error message "Block node is read-only".
    
    The device already takes care to remove all permissions when the medium
    is ejected, but the state isn't correct if the drive is initially empty:
    It uses blk_is_read_only() to check whether write permissions should be
    taken, but this function returns false for empty BlockBackends in the
    common case.
    
    Fix floppy_drive_realize() to avoid taking write permissions if the
    drive is empty.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
Loading