Stefan Hajnoczi <stefa...@redhat.com> writes:

> LVM volumes can be set read-only with "lvchange --permission r
> <volume>".  The device node permissions remain unchanged so the volume
> can still be opened O_RDWR.  Actual writes will fail.

Are you sure it's just LVM?  blockdev(8) suggests it's a more general
issue.  Check out --setro there.

> This results in odd behavior for QEMU.  bdrv_open() is supposed to fail
> if a read-only image is being opened with BDRV_O_RDWR.  By not failing
> for LVM volumes, the guest boots up but every write produces an I/O
> error.
>
> This patch checks whether the block device is read-only so that LVM
> volumes behave like regular files.
>
> Reported-by: Sibiao Luo <s...@redhat.com>
> Suggested-by: Paolo Bonzini <pbonz...@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>

Patch looks good to me.

Reply via email to