On 06.05.2014 13:10, Jan Kiszka wrote:
On 2014-05-06 12:19, Kevin Wolf wrote:
The immediately visible effect of this patch is that it fixes committing
a temporary snapshot to its backing file. Previously, it would fail with
a "permission denied" error because bdrv_inherited_flags() forced the
backing file to be read-only, ignoring the r/w reopen of bdrv_commit().
The bigger problem this releaved is that the original open flags must
actually only be applied to the temporary snapshot, and the original
image file must be treated as a backing file of the temporary snapshot
and get the right flags for that.
Reported-by: Jan Kiszka <jan.kis...@web.de>
Signed-off-by: Kevin Wolf <kw...@redhat.com>
---
block.c | 34 +++++++++++++++++++---------------
include/block/block.h | 2 +-
tests/qemu-iotests/051 | 4 ++++
tests/qemu-iotests/051.out | 10 ++++++++++
4 files changed, 34 insertions(+), 16 deletions(-)
[snip]
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index 01b0384..31e329e 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -358,4 +358,14 @@ wrote 4096/4096 bytes at offset 0
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu)
q[K[Dqe[K[D[Dqem[K[D[D[Dqemu[K[D[D[D[Dqemu-[K[D[D[D[D[Dqemu-i[K[D[D[D[D[D[Dqemu-io[K[D[D[D[D[D[D[Dqemu-io
[K[D[D[D[D[D[D[D[Dqemu-io i[K[D[D[D[D[D[D[D[D[Dqemu-io
id[K[D[D[D[D[D[D[D[D[D[Dqemu-io ide[K[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0[K[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-[K[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-h[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-hd[K[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-h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[D[D[D[D[D[D
[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io ide0-hd0 "write -P 0x33
[K[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-hd0 "write -P 0x33
0[K[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-hd0 "write -P 0x33 0
[K[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-hd0 "write -P 0x33 0
4[K[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-hd0 "write -P 0x33 0
4k[K[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[D[Dqemu-io
ide0-hd0 "write -P 0x33 0 4k"[K
+wrote 4096/4096 bytes at offset 0
+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+(qemu)
c[K[Dco[K[D[Dcom[K[D[D[Dcomm[K[D[D[D[Dcommi[K[D[D[D[D[Dcommit[K[D[D[D[D[D[Dcommit
[K[D[D[D[D[D[D[Dcommit i[K[D[D[D[D[D[D[D[Dcommit
id[K[D[D[D[D[D[D[D[D[Dcommit
ide[K[D[D[D[D[D[D[D[D[D[Dcommit
ide0[K[D[D[D[D[D[D[D[D[D[D[Dcommit
ide0-[K[D[D[D[D[D[D[D[D[D[D[D[Dcommit
ide0-h[K[D[D[D[D[D[D[D[D[D[D[D[D[Dcommit
ide0-hd[K[D[D[D[D[D[D[D[D[D[D[D[D[D[Dcommit ide0-hd0[K
+(qemu) q[K[Dqu[K[D[Dqui[K[D[D[Dquit[K
+
+read 4096/4096 bytes at offset 0
+4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
Works fine here!
(For unknown reason, applying the iotest hunk didn't work for me, though.)
The lines are too long and therefore split in this mail, they need to be
joined manually before applying the patch.
Max