qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 32a9a2: block/snapshot: Clarify goto fallback


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 32a9a2: block/snapshot: Clarify goto fallback behavior
Date: Fri, 25 Jun 2021 09:05:16 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 32a9a245d719a883eef2cbf07d2cf89efa0206d0
      
https://github.com/qemu/qemu/commit/32a9a245d719a883eef2cbf07d2cf89efa0206d0
  Author: Max Reitz <mreitz@redhat.com>
  Date:   2021-06-24 (Thu, 24 Jun 2021)

  Changed paths:
    M block/snapshot.c

  Log Message:
  -----------
  block/snapshot: Clarify goto fallback behavior

In the bdrv_snapshot_goto() fallback code, we work with a pointer to
either bs->file or bs->backing.  We detach that child, close the node
(with .bdrv_close()), apply the snapshot on the child node, and then
re-open the node (with .bdrv_open()).

In order for .bdrv_open() to attach the same child node that we had
before, we pass "file={child-node}" or "backing={child-node}" to it.
Therefore, when .bdrv_open() has returned success, we can assume that
bs->file or bs->backing (respectively) points to our original child
again.  This is verified by an assertion.

All of this is not immediately clear from a quick glance at the code,
so add a comment to the assertion what it is for, and why it is valid.
It certainly confused Coverity.

Reported-by: Coverity (CID 1452774)
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210503095418.31521-1-mreitz@redhat.com>
[mreitz: s/close/detach/]
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>


  Commit: 3593b8e0a2146a885f93d71c754757bb2c03864e
      
https://github.com/qemu/qemu/commit/3593b8e0a2146a885f93d71c754757bb2c03864e
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-06-25 (Fri, 25 Jun 2021)

  Changed paths:
    M block/snapshot.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2021-06-24' 
into staging

Block patch:
- Fix Coverity complaint in block/snapshot.c

# gpg: Signature made Thu 24 Jun 2021 12:42:28 BST
# gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg:                issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* remotes/maxreitz/tags/pull-block-2021-06-24:
  block/snapshot: Clarify goto fallback behavior

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/050cee123155...3593b8e0a214



reply via email to

[Prev in Thread] Current Thread [Next in Thread]