Skip to contentSkip to conversation

block: Fix bdrv_all_delete_snapshot() error handling

PATCH In review Kevin Wolf 3 participants 3 messages Jun 6, 2016 – Jun 7, 2016 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block: Fix bdrv_all_delete_snapshot() error handling

The code to exit the loop after bdrv_snapshot_delete_by_id_or_name() returned failure was duplicated. The first copy of it was too early so that the AioContext lock would not be freed. This patch removes it so that only the second, correct copy remains.

---
 block/snapshot.c | 3 ---
 1 file changed, 3 deletions(-)
block/snapshot.c +0 -3
index 6e6e34f..da89d2b 100644
@@ -409,9 +409,6 @@ int bdrv_all_delete_snapshot(const char *name, BlockDriverState **first_bad_bs,
         if (bdrv_can_snapshot(bs) &&
                 bdrv_snapshot_find(bs, snapshot, name) >= 0) {
             ret = bdrv_snapshot_delete_by_id_or_name(bs, name, err);
-            if (ret < 0) {
-                goto fail;
-            }
         }
         aio_context_release(ctx);
         if (ret < 0) {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Kevin Wolf

The code to exit the loop after bdrv_snapshot_delete_by_id_or_name() returned failure was duplicated. The first copy of it was too early so that the AioContext lock would not be freed. This patch removes it so that only the second, correct copy remains.

---
 block/snapshot.c | 3 ---
 1 file changed, 3 deletions(-)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Wolf
Quoted 9 lines · Kevin Wolf

The code to exit the loop after bdrv_snapshot_delete_by_id_or_name() returned failure was duplicated. The first copy of it was too early so that the AioContext lock would not be freed. This patch removes it so that only the second, correct copy remains.

---
 block/snapshot.c | 3 ---
 1 file changed, 3 deletions(-)