[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 21/29] block: Mark bdrv_co_delete_file() and callers GRAPH_RDLOCK
From: |
Kevin Wolf |
Subject: |
[PULL 21/29] block: Mark bdrv_co_delete_file() and callers GRAPH_RDLOCK |
Date: |
Thu, 23 Feb 2023 19:51:38 +0100 |
This adds GRAPH_RDLOCK annotations to declare that callers of
bdrv_co_delete_file() need to hold a reader lock for the graph.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230203152202.49054-22-kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block-io.h | 8 ++++++--
include/block/block_int-common.h | 4 ++--
block.c | 1 +
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/include/block/block-io.h b/include/block/block-io.h
index bf2748011e..a195a9fb11 100644
--- a/include/block/block-io.h
+++ b/include/block/block-io.h
@@ -90,8 +90,12 @@ int64_t co_wrapper
bdrv_get_allocated_file_size(BlockDriverState *bs);
BlockMeasureInfo *bdrv_measure(BlockDriver *drv, QemuOpts *opts,
BlockDriverState *in_bs, Error **errp);
void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
-int coroutine_fn bdrv_co_delete_file(BlockDriverState *bs, Error **errp);
-void coroutine_fn bdrv_co_delete_file_noerr(BlockDriverState *bs);
+
+int coroutine_fn GRAPH_RDLOCK
+bdrv_co_delete_file(BlockDriverState *bs, Error **errp);
+
+void coroutine_fn GRAPH_RDLOCK
+bdrv_co_delete_file_noerr(BlockDriverState *bs);
/* async block I/O */
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index 88d9897c97..257a9d18c6 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -649,8 +649,8 @@ struct BlockDriver {
int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_flush)(BlockDriverState *bs);
/* Delete a created file. */
- int coroutine_fn (*bdrv_co_delete_file)(BlockDriverState *bs,
- Error **errp);
+ int coroutine_fn GRAPH_RDLOCK_PTR (*bdrv_co_delete_file)(
+ BlockDriverState *bs, Error **errp);
/*
* Flushes all data that was already written to the OS all the way down to
diff --git a/block.c b/block.c
index 1060194e8f..c4c67d09d4 100644
--- a/block.c
+++ b/block.c
@@ -740,6 +740,7 @@ int coroutine_fn bdrv_co_delete_file(BlockDriverState *bs,
Error **errp)
IO_CODE();
assert(bs != NULL);
+ assert_bdrv_graph_readable();
if (!bs->drv) {
error_setg(errp, "Block node '%s' is not opened", bs->filename);
--
2.39.2
- [PULL 09/29] block: Mark bdrv_co_pwrite_zeroes() and callers GRAPH_RDLOCK, (continued)
- [PULL 09/29] block: Mark bdrv_co_pwrite_zeroes() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 10/29] block: Mark read/write in block/io.c GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 11/29] block: Mark public read/write functions GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 13/29] block: Mark bdrv_co_do_pwrite_zeroes() GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 07/29] block: Mark bdrv_co_flush() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 08/29] block: Mark bdrv_co_pdiscard() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 12/29] block: Mark bdrv_co_pwrite_sync() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 15/29] block: Mark preadv_snapshot/snapshot_block_status GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 18/29] block: Mark bdrv_co_is_inserted() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 19/29] block: Mark bdrv_co_eject/lock_medium() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 21/29] block: Mark bdrv_co_delete_file() and callers GRAPH_RDLOCK,
Kevin Wolf <=
- [PULL 20/29] block: Mark bdrv_(un)register_buf() GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 14/29] block: Mark bdrv_co_copy_range() GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 23/29] block: Mark bdrv_co_refresh_total_sectors() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 17/29] block: Mark bdrv_co_io_(un)plug() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 24/29] scsi: protect req->aiocb with AioContext lock, Kevin Wolf, 2023/02/23
- [PULL 22/29] block: Mark bdrv_*_dirty_bitmap() and callers GRAPH_RDLOCK, Kevin Wolf, 2023/02/23
- [PULL 25/29] dma-helpers: prevent dma_blk_cb() vs dma_aio_cancel() race, Kevin Wolf, 2023/02/23
- [PULL 27/29] block/rbd: Remove redundant stack variable passphrase_len, Kevin Wolf, 2023/02/23
- [PULL 28/29] block/rbd: Add luks-any encryption opening option, Kevin Wolf, 2023/02/23
- [PULL 26/29] virtio-scsi: reset SCSI devices from main loop thread, Kevin Wolf, 2023/02/23