OSDN Git Service

block/mirror: Fix mirror_top's permissions
authorMax Reitz <mreitz@redhat.com>
Thu, 11 Feb 2021 17:22:41 +0000 (18:22 +0100)
committerMax Reitz <mreitz@redhat.com>
Mon, 29 Mar 2021 16:09:00 +0000 (18:09 +0200)
commit53431b9086b2832ca1aeff0c55e186e9ed79bd11
tree07ac004ddb909b39fa282df281d70cc1828bbb36
parent6d7bb95180b9313c8deb65671e65174205b1fd83
block/mirror: Fix mirror_top's permissions

mirror_top currently shares all permissions, and takes only the WRITE
permission (if some parent has taken that permission, too).

That is wrong, though; mirror_top is a filter, so it should take
permissions like any other filter does.  For example, if the parent
needs CONSISTENT_READ, we need to take that, too, and if it cannot share
the WRITE permission, we cannot share it either.

The exception is when mirror_top is used for active commit, where we
cannot take CONSISTENT_READ (because it is deliberately unshared above
the base node) and where we must share WRITE (so that it is shared for
all images in the backing chain, so the mirror job can take it for the
target BB).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210211172242.146671-2-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
block/mirror.c