[PATCH v2 12/20] mirror: Require GRAPH_RDLOCK for accessing a node's parent list

Kevin Wolf posted 20 patches 2 years, 7 months ago
[PATCH v2 12/20] mirror: Require GRAPH_RDLOCK for accessing a node's parent list
Posted by Kevin Wolf 2 years, 7 months ago
This adds GRAPH_RDLOCK annotations to declare that functions accessing
the parent list of a node need to hold a reader lock for the graph. As
it happens, they already do.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/mirror.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/mirror.c b/block/mirror.c
index 80fa345071..b5c4ae31f3 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1416,7 +1416,7 @@ static MirrorOp *coroutine_fn active_write_prepare(MirrorBlockJob *s,
     return op;
 }
 
-static void coroutine_fn active_write_settle(MirrorOp *op)
+static void coroutine_fn GRAPH_RDLOCK active_write_settle(MirrorOp *op)
 {
     uint64_t start_chunk = op->offset / op->s->granularity;
     uint64_t end_chunk = DIV_ROUND_UP(op->offset + op->bytes,
-- 
2.40.1
Re: [PATCH v2 12/20] mirror: Require GRAPH_RDLOCK for accessing a node's parent list
Posted by Eric Blake 2 years, 7 months ago
On Thu, May 04, 2023 at 01:57:42PM +0200, Kevin Wolf wrote:
> This adds GRAPH_RDLOCK annotations to declare that functions accessing
> the parent list of a node need to hold a reader lock for the graph. As
> it happens, they already do.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/mirror.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/block/mirror.c b/block/mirror.c
> index 80fa345071..b5c4ae31f3 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -1416,7 +1416,7 @@ static MirrorOp *coroutine_fn active_write_prepare(MirrorBlockJob *s,
>      return op;
>  }
>  
> -static void coroutine_fn active_write_settle(MirrorOp *op)
> +static void coroutine_fn GRAPH_RDLOCK active_write_settle(MirrorOp *op)
>  {
>      uint64_t start_chunk = op->offset / op->s->granularity;
>      uint64_t end_chunk = DIV_ROUND_UP(op->offset + op->bytes,
> -- 
> 2.40.1
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Re: [PATCH v2 12/20] mirror: Require GRAPH_RDLOCK for accessing a node's parent list
Posted by Kevin Wolf 2 years, 7 months ago
Am 04.05.2023 um 15:17 hat Eric Blake geschrieben:
> On Thu, May 04, 2023 at 01:57:42PM +0200, Kevin Wolf wrote:
> > This adds GRAPH_RDLOCK annotations to declare that functions accessing
> > the parent list of a node need to hold a reader lock for the graph. As
> > it happens, they already do.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  block/mirror.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>

Oops, sorry for failing to pick up your R-b for this patch in v1 (seems
I only changed the subject line and forgot about the reviews), and
thanks for renewing it. :-)

Kevin