OSDN Git Service

block/mirror: Fix child permissions
authorMax Reitz <mreitz@redhat.com>
Wed, 22 May 2019 17:03:47 +0000 (19:03 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 Jun 2019 14:41:10 +0000 (16:41 +0200)
commitf94dc3b414028bc762f51ea66c170276130d5f8a
tree5d6e1ea11ecb9dd97ac872b2489a6a98ac8d483a
parentc1087f12066a1ff34153dd10662c1a46a874087c
block/mirror: Fix child permissions

We cannot use bdrv_child_try_set_perm() to give up all restrictions on
the child edge, and still have bdrv_mirror_top_child_perm() request
BLK_PERM_WRITE.  Fix this by making bdrv_mirror_top_child_perm() return
0/BLK_PERM_ALL when we want to give up all permissions, and replacing
bdrv_child_try_set_perm() by bdrv_child_refresh_perms().

The bdrv_child_try_set_perm() before removing the node with
bdrv_replace_node() is then unnecessary.  No permissions have changed
since the previous invocation of bdrv_child_try_set_perm().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c