On 17.07.20 12:54, Kevin Wolf wrote:
> For Linux block devices, being able to open the device read-write
> doesn't necessarily mean that the device is actually writable (one
> example is a read-only LV, as you get with lvchange -pr <device>). We
> have check_hdev_writable() to check this condition and fail opening the
> image read-write if it's not actually writable.
> 
> However, this check doesn't take auto-read-only into account, but
> results in a hard failure instead of downgrading to read-only where
> possible.
> 
> Fix this and do the writable check not based on BDRV_O_RDWR, but only
> when this actually results in opening the file read-write. A second
> check is inserted in raw_reconfigure_getfd() to have the same check when
> dynamic auto-read-only upgrades an image file from read-only to
> read-write.
> 
> Signed-off-by: Kevin Wolf <kw...@redhat.com>
> ---
>  block/file-posix.c | 33 +++++++++++++++++++++------------
>  1 file changed, 21 insertions(+), 12 deletions(-)

Reviewed-by: Max Reitz <mre...@redhat.com>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to