qcow2: Mark qcow2_inactivate() and callers GRAPH_RDLOCK
commitde4fed6f4ef7f2f1a1bce50a2cbbb7fdd397b7ec
authorKevin Wolf <kwolf@redhat.com>
Fri, 29 Sep 2023 14:51:50 +0000 (29 16:51 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 12 Oct 2023 14:31:33 +0000 (12 16:31 +0200)
treee082983d806ff834220a9d9ad725c91d3e2b044c
parent0bb79c97fd8e355aca433f4331d7d45e7e72b4b6
qcow2: Mark qcow2_inactivate() and callers GRAPH_RDLOCK

This adds GRAPH_RDLOCK annotations to declare that callers of
qcow2_inactivate() need to hold a reader lock for the graph because it
calls bdrv_get_device_or_node_name(), which accesses the parents list of
a node.

qcow2_do_close() is a bit strange because it is called from different
contexts. If close_data_file = true, we know that we were called from
non-coroutine main loop context (more specifically, we're coming from
qcow2_close()) and can safely drop the reader lock temporarily with
bdrv_graph_rdunlock_main_loop() and acquire the writer lock.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20230929145157.45443-16-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c