diff mbox series

[v7,07/21] block: bdrv_check_perm(): process children anyway

Message ID 20201021145859.11201-8-vsementsov@virtuozzo.com
State Accepted
Commit 9530a25b8b7eb5cc1800b66ee617610cd43f0fad
Headers show
Series preallocate filter | expand

Commit Message

Vladimir Sementsov-Ogievskiy Oct. 21, 2020, 2:58 p.m. UTC
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 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Max Reitz Nov. 13, 2020, 1:59 p.m. UTC | #1
On 21.10.20 16:58, 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 | 7 +++++--

>   1 file changed, 5 insertions(+), 2 deletions(-)


Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox series

Patch

diff --git a/block.c b/block.c
index 430edf79bb..4f7c27aa6d 100644
--- a/block.c
+++ b/block.c
@@ -2048,8 +2048,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;
+        }
     }
 
     /* Drivers that never have children can omit .bdrv_child_perm() */