[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/20] graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock
From: |
Kevin Wolf |
Subject: |
[PATCH v2 07/20] graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock |
Date: |
Thu, 4 May 2023 13:57:37 +0200 |
GRAPH_RDLOCK_GUARD() and GRAPH_RDLOCK_GUARD_MAINLOOP() only take a
reader lock for the graph, so the correct annotation for them to use is
TSA_ASSERT_SHARED rather than TSA_ASSERT.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/block/graph-lock.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/block/graph-lock.h b/include/block/graph-lock.h
index f17d1588e7..7574a2de5b 100644
--- a/include/block/graph-lock.h
+++ b/include/block/graph-lock.h
@@ -205,12 +205,12 @@ typedef struct GraphLockable { } GraphLockable;
#define GML_OBJ_() (&(GraphLockable) { })
/*
- * This is not marked as TSA_ACQUIRE() because TSA doesn't understand the
+ * This is not marked as TSA_ACQUIRE_SHARED() because TSA doesn't understand
the
* cleanup attribute and would therefore complain that the graph is never
- * unlocked. TSA_ASSERT() makes sure that the following calls know that we
- * hold the lock while unlocking is left unchecked.
+ * unlocked. TSA_ASSERT_SHARED() makes sure that the following calls know that
+ * we hold the lock while unlocking is left unchecked.
*/
-static inline GraphLockable * TSA_ASSERT(graph_lock) TSA_NO_TSA coroutine_fn
+static inline GraphLockable * TSA_ASSERT_SHARED(graph_lock) TSA_NO_TSA
coroutine_fn
graph_lockable_auto_lock(GraphLockable *x)
{
bdrv_graph_co_rdlock();
@@ -249,12 +249,12 @@ typedef struct GraphLockableMainloop { }
GraphLockableMainloop;
#define GMLML_OBJ_() (&(GraphLockableMainloop) { })
/*
- * This is not marked as TSA_ACQUIRE() because TSA doesn't understand the
+ * This is not marked as TSA_ACQUIRE_SHARED() because TSA doesn't understand
the
* cleanup attribute and would therefore complain that the graph is never
- * unlocked. TSA_ASSERT() makes sure that the following calls know that we
- * hold the lock while unlocking is left unchecked.
+ * unlocked. TSA_ASSERT_SHARED() makes sure that the following calls know that
+ * we hold the lock while unlocking is left unchecked.
*/
-static inline GraphLockableMainloop * TSA_ASSERT(graph_lock) TSA_NO_TSA
+static inline GraphLockableMainloop * TSA_ASSERT_SHARED(graph_lock) TSA_NO_TSA
graph_lockable_auto_lock_mainloop(GraphLockableMainloop *x)
{
bdrv_graph_rdlock_main_loop();
--
2.40.1
- [PATCH v2 03/20] block: bdrv/blk_co_unref() for calls in coroutine context, (continued)
- [PATCH v2 03/20] block: bdrv/blk_co_unref() for calls in coroutine context, Kevin Wolf, 2023/05/04
- [PATCH v2 04/20] block: Don't call no_coroutine_fns in qmp_block_resize(), Kevin Wolf, 2023/05/04
- [PATCH v2 05/20] test-bdrv-drain: Don't modify the graph in coroutines, Kevin Wolf, 2023/05/04
- [PATCH v2 06/20] graph-lock: Add GRAPH_UNLOCKED(_PTR), Kevin Wolf, 2023/05/04
- [PATCH v2 09/20] nbd: Remove nbd_co_flush() wrapper function, Kevin Wolf, 2023/05/04
- [PATCH v2 14/20] block: Mark bdrv_co_get_info() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 11/20] vhdx: Require GRAPH_RDLOCK for accessing a node's parent list, Kevin Wolf, 2023/05/04
- [PATCH v2 16/20] block: Mark BlockDriver callbacks for amend job GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 15/20] block: Mark bdrv_co_debug_event() GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 07/20] graph-lock: Fix GRAPH_RDLOCK_GUARD*() to be reader lock,
Kevin Wolf <=
- [PATCH v2 12/20] mirror: Require GRAPH_RDLOCK for accessing a node's parent list, Kevin Wolf, 2023/05/04
- [PATCH v2 13/20] block: Mark bdrv_co_get_allocated_file_size() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 20/20] block: Mark bdrv_refresh_limits() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 08/20] block: .bdrv_open is non-coroutine and unlocked, Kevin Wolf, 2023/05/04
- [PATCH v2 10/20] nbd: Mark nbd_co_do_establish_connection() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 17/20] block: Mark bdrv_query_bds_stats() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 18/20] block: Mark bdrv_query_block_graph_info() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04
- [PATCH v2 19/20] block: Mark bdrv_recurse_can_replace() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/05/04