[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/18] test-bdrv-drain: Take graph lock more selectively
From: |
Kevin Wolf |
Subject: |
[PULL 12/18] test-bdrv-drain: Take graph lock more selectively |
Date: |
Wed, 17 May 2023 18:51:10 +0200 |
If we take a reader lock, we can't call any functions that take a writer
lock internally without causing deadlocks once the reader lock is
actually enforced in the main thread, too. Take the reader lock only
where it is actually needed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230510203601.418015-6-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/unit/test-bdrv-drain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/unit/test-bdrv-drain.c b/tests/unit/test-bdrv-drain.c
index 9a4c5e59d6..ae4299ccfa 100644
--- a/tests/unit/test-bdrv-drain.c
+++ b/tests/unit/test-bdrv-drain.c
@@ -1004,8 +1004,6 @@ static void coroutine_fn test_co_delete_by_drain(void
*opaque)
void *buffer = g_malloc(65536);
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buffer, 65536);
- GRAPH_RDLOCK_GUARD();
-
/* Pretend some internal write operation from parent to child.
* Important: We have to read from the child, not from the parent!
* Draining works by first propagating it all up the tree to the
@@ -1014,7 +1012,9 @@ static void coroutine_fn test_co_delete_by_drain(void
*opaque)
* everything will be drained before we go back down the tree, but
* we do not want that. We want to be in the middle of draining
* when this following requests returns. */
+ bdrv_graph_co_rdlock();
bdrv_co_preadv(tts->wait_child, 0, 65536, &qiov, 0);
+ bdrv_graph_co_rdunlock();
g_assert_cmpint(bs->refcnt, ==, 1);
--
2.40.1
- [PULL 01/18] blockdev: refactor transaction to use Transaction API, (continued)
- [PULL 01/18] blockdev: refactor transaction to use Transaction API, Kevin Wolf, 2023/05/17
- [PULL 02/18] blockdev: transactions: rename some things, Kevin Wolf, 2023/05/17
- [PULL 03/18] blockdev: qmp_transaction: refactor loop to classic for, Kevin Wolf, 2023/05/17
- [PULL 07/18] docs/interop/qcow2.txt: fix description about "zlib" clusters, Kevin Wolf, 2023/05/17
- [PULL 05/18] blockdev: use state.bitmap in block-dirty-bitmap-add action, Kevin Wolf, 2023/05/17
- [PULL 04/18] blockdev: transaction: refactor handling transaction properties, Kevin Wolf, 2023/05/17
- [PULL 06/18] blockdev: qmp_transaction: drop extra generic layer, Kevin Wolf, 2023/05/17
- [PULL 08/18] block: Call .bdrv_co_create(_opts) unlocked, Kevin Wolf, 2023/05/17
- [PULL 10/18] qcow2: Unlock the graph in qcow2_do_open() where necessary, Kevin Wolf, 2023/05/17
- [PULL 09/18] block/export: Fix null pointer dereference in error path, Kevin Wolf, 2023/05/17
- [PULL 12/18] test-bdrv-drain: Take graph lock more selectively,
Kevin Wolf <=
- [PULL 11/18] qemu-img: Take graph lock more selectively, Kevin Wolf, 2023/05/17
- [PULL 14/18] blockjob: Adhere to rate limit even when reentered early, Kevin Wolf, 2023/05/17
- [PULL 16/18] iotests/245: Check if 'compress' driver is available, Kevin Wolf, 2023/05/17
- [PULL 17/18] aio-posix: do not nest poll handlers, Kevin Wolf, 2023/05/17
- [PULL 15/18] graph-lock: Honour read locks even in the main thread, Kevin Wolf, 2023/05/17
- [PULL 18/18] tested: add test for nested aio_poll() in poll handlers, Kevin Wolf, 2023/05/17