Max Reitz 32a9a245d7 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>
2021-06-24 09:49:04 +02:00
..
2019-10-10 10:56:17 +02:00
2021-04-30 12:27:48 +02:00
2020-05-18 19:05:25 +02:00
2020-05-18 19:05:25 +02:00
2021-02-15 15:10:14 +01:00
2021-03-19 10:15:06 +01:00
2020-11-09 15:44:21 +01:00
2021-01-08 15:13:38 +00:00
2021-06-04 13:47:07 +02:00
2021-03-11 13:57:08 +00:00
2020-09-15 11:05:13 +02:00
2020-07-06 10:34:14 +02:00