block: Pass BdrvChild ** to replace_child_noperm
commitbe64bbb0149748f3999c49b13976aafb8330ea86
authorHanna Reitz <hreitz@redhat.com>
Mon, 15 Nov 2021 14:54:01 +0000 (15 15:54 +0100)
committerHanna Reitz <hreitz@redhat.com>
Tue, 16 Nov 2021 08:43:41 +0000 (16 09:43 +0100)
tree45d40c2ba760a0f8460e741f010f332728d58d80
parent265180614189b969058f5e507c8964fc7dfd422f
block: Pass BdrvChild ** to replace_child_noperm

bdrv_replace_child_noperm() modifies BdrvChild.bs, and can potentially
set it to NULL.  That is dangerous, because BDS parents generally assume
that their children's .bs pointer is never NULL.  We therefore want to
let bdrv_replace_child_noperm() set the corresponding BdrvChild pointer
to NULL, too.

This patch lays the foundation for it by passing a BdrvChild ** pointer
to bdrv_replace_child_noperm() so that it can later use it to NULL the
BdrvChild pointer immediately after setting BdrvChild.bs to NULL.

(We will still need to undertake some intermediate steps, though.)

Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20211111120829.81329-6-hreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20211115145409.176785-6-kwolf@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
block.c