Skip to contentSkip to conversation

snapshot: fix referencing wrong variable in while loop in do_delvm

PATCH Applied Zhang Haoyu 4 participants 5 messages Sep 29, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 snapshot: fix referencing wrong variable in while loop in do_delvm

The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name. Broken in commit a89d89d, v1.7.0.

v1 -> v2:
* add broken commit id to commit message

---
 savevm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
savevm.c +5 -6
index e19ae0a..2d8eb96 100644
@@ -1245,19 +1245,18 @@ int load_vmstate(const char *name)
 
 void do_delvm(Monitor *mon, const QDict *qdict)
 {
-    BlockDriverState *bs, *bs1;
+    BlockDriverState *bs;
     Error *err = NULL;
     const char *name = qdict_get_str(qdict, "name");
 
-    bs = find_vmstate_bs();
-    if (!bs) {
+    if (!find_vmstate_bs()) {
         monitor_printf(mon, "No block device supports snapshots\n");
         return;
     }
 
-    bs1 = NULL;
-    while ((bs1 = bdrv_next(bs1))) {
-        if (bdrv_can_snapshot(bs1)) {
+    bs = NULL;
+    while ((bs = bdrv_next(bs))) {
+        if (bdrv_can_snapshot(bs)) {
             bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
             if (err) {
                 monitor_printf(mon,
Signature · 1 line
1.7.12.4
#1 lore raw

Dropping cc: [email protected], because I got a "user unknown" bounce.

Copying qemu-stable.

Quoted 6 lines · Zhang Haoyu

The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name. Broken in commit a89d89d, v1.7.0.

v1 -> v2:
* add broken commit id to commit message

Patch version information...

Quoted 3 lines

---

... goes here, so it doesn't go into the permanent commit message. Maybe Kevin or Stefan can clean it up on commit.

Quoted 2 lines
 savevm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

[...]

Reviewed-by on v2 1/1
#3 lore raw
In reply to Zhang Haoyu

Am 29.09.2014 um 10:38 hat Zhang Haoyu geschrieben:

Quoted 9 lines

The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name. Broken in commit a89d89d, v1.7.0.

v1 -> v2:
* add broken commit id to commit message

We should probably add a qemu-iotests case for the handling of internal snapshots on VMs with multiple images. Any volunteer?

Kevin

#2 lore raw
In reply to Markus Armbruster
Quoted 7 lines · Markus Armbruster
Quoted 6 lines

The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name. Broken in commit a89d89d, v1.7.0.

v1 -> v2:
* add broken commit id to commit message

Quoted 8 lines

Patch version information...

Quoted 3 lines

---

... goes here, so it doesn't go into the permanent commit message. Maybe Kevin or Stefan can clean it up on commit.

No problem, we'll drop the changelog when applying the patch this time.

Thanks for reviewing, Markus.

#4 lore raw
In reply to Zhang Haoyu
Quoted 4 lines · Zhang Haoyu

The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name. Broken in commit a89d89d, v1.7.0.

Quoted 8 lines

v1 -> v2:
* add broken commit id to commit message

---
 savevm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan