1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
mistranslation: 0.866
other: 0.857
vnc: 0.823
instruction: 0.795
KVM: 0.751
graphic: 0.748
device: 0.722
assembly: 0.700
semantic: 0.659
socket: 0.641
network: 0.635
boot: 0.447
Disk corrupted after snapshot deletion
I found the vm disk corruption after snapshot deletion sometimes(the probability is very low, I'm afraid i can't reproduce it). And I found there is a patch for it as follow, but I'm not sure whether the patch repaired the bug.
Drain disk before snapshot deletion can't guarantee anything, there is still pending IO in snapshot-deletion process. Anyone can help?
author Zhang Haoyu <email address hidden> 2014-10-21 16:38:01 +0800
committer Stefan Hajnoczi <email address hidden> 2014-11-03 09:48:42 +0000
commit 3432a1929ee18e08787ce35476abd74f2c93a17c (patch)
tree 13a81c0a46707d91622f1593ccf7b926935371fd /block/snapshot.c
parent 573742a5431a99ceaba6968ae269cee247727cce (diff)
snapshot: add bdrv_drain_all() to bdrv_snapshot_delete() to avoid concurrency problem
If there are still pending i/o while deleting snapshot,
because deleting snapshot is done in non-coroutine context, and
the pending i/o read/write (bdrv_co_do_rw) is done in coroutine context,
so it's possible to cause concurrency problem between above two operations.
Add bdrv_drain_all() to bdrv_snapshot_delete() to avoid this problem.
Signed-off-by: Zhang Haoyu <email address hidden>
Reviewed-by: Paolo Bonzini <email address hidden>
Message-id: <email address hidden>
Signed-off-by: Stefan Hajnoczi <email address hidden>
Diffstat (limited to 'block/snapshot.c')
-rw-r--r-- block/snapshot.c 4
1 files changed, 4 insertions, 0 deletions
diff --git a/block/snapshot.c b/block/snapshot.c
index 85c52ff..698e1a1 100644
--- a/block/snapshot.c
+++ b/block/snapshot.c
@@ -236,6 +236,10 @@ int bdrv_snapshot_delete(BlockDriverState *bs,
error_setg(errp, "snapshot_id and name are both NULL");
return -EINVAL;
}
+
+ /* drain all pending i/o before deleting snapshot */
+ bdrv_drain_all();
+
if (drv->bdrv_snapshot_delete) {
return drv->bdrv_snapshot_delete(bs, snapshot_id, name, errp);
}
My qemu version is 2.1.2
Please try again with the latest release of QEMU first (currently 2.9, or the latest RC of 2.10). QEMU 2.1.2 is very old, the bug might have been fixed in the latest release already.
Thanks for your reply
For some reason, I can't update my version. I believe the latest version have fixed the problem in commit 3432a1929ee18e08787ce35476abd74f2c93a17c or 27a7649a48f9019fa5bd2998d8e342791397bdda. But I'm not sure the first patch have fixed the problem, as the second patch is too much change for me.
[Expired for QEMU because there has been no activity for 60 days.]
|