file-posix: Fix bdrv_open_flags() for snapshot=on
commit30855137783c0c762007044821a6f11e14e6af33
authorKevin Wolf <kwolf@redhat.com>
Mon, 11 Mar 2019 15:13:16 +0000 (11 16:13 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 12 Mar 2019 19:30:14 +0000 (12 20:30 +0100)
treed30b921270e23e1d0852e0c18533c7967be4add6
parent69b736e76567ecbc9b9e55570bc0afc840614a98
file-posix: Fix bdrv_open_flags() for snapshot=on

Using a different read-only setting for bs->open_flags than for the
flags to the driver's open function is just inconsistent and a bad idea.
After this patch, the temporary snapshot keeps being opened read-only if
read-only=on,snapshot=on is passed.

If we wanted to change this behaviour to make only the orginal image
file read-only, but the temporary overlay read-write (as the comment in
the removed code suggests), that change would have to be made in
bdrv_temp_snapshot_options() (where the comment suggests otherwise).

Addressing this inconsistency before introducing dynamic auto-read-only
is important because otherwise we would immediately try to reopen the
temporary overlay even though the file is already unlinked.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
tests/qemu-iotests/051
tests/qemu-iotests/051.out
tests/qemu-iotests/051.pc.out