Skip to content
  • Paolo Bonzini's avatar
    0eb2baeb
    scsi-generic: let guests recognize readonly=on on passthrough devices · 0eb2baeb
    Paolo Bonzini authored
    
    
    Passed-through SCSI devices can be opened with the readonly=on option.
    When this happens, Linux filters away write commands so that the guest
    cannot overwrite the contents of the device.
    
    However, the guest does not know that the device is read-only, and
    accepts writes.  The writes only fail later when the page cache is
    flushed.
    
    This patch modifies scsi-generic to modify the MODE SENSE data and
    set the read-only bit in the device-specific parameters, so that
    the guest OS treats the disk as write protected.
    
    Reviewed-by: default avatarFam Zheng <famz@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    0eb2baeb
    scsi-generic: let guests recognize readonly=on on passthrough devices
    Paolo Bonzini authored
    
    
    Passed-through SCSI devices can be opened with the readonly=on option.
    When this happens, Linux filters away write commands so that the guest
    cannot overwrite the contents of the device.
    
    However, the guest does not know that the device is read-only, and
    accepts writes.  The writes only fail later when the page cache is
    flushed.
    
    This patch modifies scsi-generic to modify the MODE SENSE data and
    set the read-only bit in the device-specific parameters, so that
    the guest OS treats the disk as write protected.
    
    Reviewed-by: default avatarFam Zheng <famz@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading