[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 07/15] block: bdrv_check_perm(): process children anyway
From: |
Max Reitz |
Subject: |
Re: [PATCH v6 07/15] block: bdrv_check_perm(): process children anyway |
Date: |
Thu, 24 Sep 2020 16:25:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 18.09.20 20:19, Vladimir Sementsov-Ogievskiy wrote:
> Do generic processing even for drivers which define .bdrv_check_perm
> handler. It's needed for further preallocate filter: it will need to do
> additional action on bdrv_check_perm, but don't want to reimplement
> generic logic.
>
> The patch doesn't change existing behaviour: the only driver that
> implements bdrv_check_perm is file-posix, but it never has any
> children.
>
> Also, bdrv_set_perm() don't stop processing if driver has
> .bdrv_set_perm handler as well.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> block.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/block.c b/block.c
> index 9538af4884..165c2d3cb2 100644
> --- a/block.c
> +++ b/block.c
> @@ -1964,8 +1964,7 @@ static void bdrv_child_perm(BlockDriverState *bs,
> BlockDriverState *child_bs,
> /*
> * Check whether permissions on this node can be changed in a way that
> * @cumulative_perms and @cumulative_shared_perms are the new cumulative
> - * permissions of all its parents. This involves checking whether all
> necessary
> - * permission changes to child nodes can be performed.
> + * permissions of all its parents.
Why do you want to remove this sentence?
> *
> * Will set *tighten_restrictions to true if and only if new permissions
> have to
> * be taken or currently shared permissions are to be unshared. Otherwise,
> @@ -2047,8 +2046,11 @@ static int bdrv_check_perm(BlockDriverState *bs,
> BlockReopenQueue *q,
> }
>
> if (drv->bdrv_check_perm) {
> - return drv->bdrv_check_perm(bs, cumulative_perms,
> - cumulative_shared_perms, errp);
> + ret = drv->bdrv_check_perm(bs, cumulative_perms,
> + cumulative_shared_perms, errp);
> + if (ret < 0) {
> + return ret;
> + }
> }
Sounds good. It’s also consistent with how bdrv_abort_perm_update() and
bdrv_set_perm() don’t return after calling the respective driver
functions, but always recurse to the children.
Max
signature.asc
Description: OpenPGP digital signature
- [PATCH v6 00/15] preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 01/15] block: simplify comment to BDRV_REQ_SERIALISING, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 02/15] block/io.c: drop assertion on double waiting for request serialisation, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 03/15] block/io: split out bdrv_find_conflicting_request, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 05/15] block: bdrv_mark_request_serialising: split non-waiting function, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 04/15] block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 06/15] block: introduce BDRV_REQ_NO_WAIT flag, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 07/15] block: bdrv_check_perm(): process children anyway, Vladimir Sementsov-Ogievskiy, 2020/09/18
- Re: [PATCH v6 07/15] block: bdrv_check_perm(): process children anyway,
Max Reitz <=
- [PATCH v6 09/15] qemu-io: add preallocate mode parameter for truncate command, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 08/15] block: introduce preallocate filter, Vladimir Sementsov-Ogievskiy, 2020/09/18
- [PATCH v6 11/15] iotests: add 298 to test new preallocate filter driver, Vladimir Sementsov-Ogievskiy, 2020/09/18