[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 05/31] block-backend: special comments for blk_set/get_perm du
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v5 05/31] block-backend: special comments for blk_set/get_perm due to fuse |
Date: |
Wed, 24 Nov 2021 01:43:52 -0500 |
Fuse logic can be classified as I/O, so there is no BQL held
during its execution. And yet, it uses blk_{get/set}_perm
functions, that are classified as BQL and clearly require
the BQL lock. Since there is no easy solution for this,
add a couple of TODOs and FIXME in the relevant sections of the
code.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/block-backend.c | 10 ++++++++++
block/export/fuse.c | 16 ++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 1f0bda578e..7a4b50a8f0 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -888,6 +888,11 @@ int blk_set_perm(BlockBackend *blk, uint64_t perm,
uint64_t shared_perm,
Error **errp)
{
int ret;
+ /*
+ * FIXME: blk_{get/set}_perm should be always called under
+ * BQL, but it is not the case right now (see block/export/fuse.c)
+ */
+ /* assert(qemu_in_main_thread()); */
if (blk->root && !blk->disable_perm) {
ret = bdrv_child_try_set_perm(blk->root, perm, shared_perm, errp);
@@ -904,6 +909,11 @@ int blk_set_perm(BlockBackend *blk, uint64_t perm,
uint64_t shared_perm,
void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm)
{
+ /*
+ * FIXME: blk_{get/set}_perm should be always called under
+ * BQL, but it is not the case right now (see block/export/fuse.c)
+ */
+ /* assert(qemu_in_main_thread()); */
*perm = blk->perm;
*shared_perm = blk->shared_perm;
}
diff --git a/block/export/fuse.c b/block/export/fuse.c
index 823c126d23..7ceb8d783b 100644
--- a/block/export/fuse.c
+++ b/block/export/fuse.c
@@ -89,7 +89,10 @@ static int fuse_export_create(BlockExport *blk_exp,
/* For growable exports, take the RESIZE permission */
if (args->growable) {
uint64_t blk_perm, blk_shared_perm;
-
+ /*
+ * FIXME: blk_{get/set}_perm should not be here, as permissions
+ * should be modified only under BQL and here we are not!
+ */
blk_get_perm(exp->common.blk, &blk_perm, &blk_shared_perm);
ret = blk_set_perm(exp->common.blk, blk_perm | BLK_PERM_RESIZE,
@@ -400,6 +403,11 @@ static int fuse_do_truncate(const FuseExport *exp, int64_t
size,
/* Growable exports have a permanent RESIZE permission */
if (!exp->growable) {
+
+ /*
+ * FIXME: blk_{get/set}_perm should not be here, as permissions
+ * should be modified only under BQL and here we are not!
+ */
blk_get_perm(exp->common.blk, &blk_perm, &blk_shared_perm);
ret = blk_set_perm(exp->common.blk, blk_perm | BLK_PERM_RESIZE,
@@ -413,7 +421,11 @@ static int fuse_do_truncate(const FuseExport *exp, int64_t
size,
truncate_flags, NULL);
if (!exp->growable) {
- /* Must succeed, because we are only giving up the RESIZE permission */
+ /*
+ * Must succeed, because we are only giving up the RESIZE permission.
+ * FIXME: blk_{get/set}_perm should not be here, as permissions
+ * should be modified only under BQL and here we are not!
+ */
blk_set_perm(exp->common.blk, blk_perm, blk_shared_perm, &error_abort);
}
--
2.27.0
- [PATCH v5 00/31] block layer: split block APIs in global state and I/O, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 01/31] main-loop.h: introduce qemu_in_main_thread(), Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 04/31] include/sysemu/block-backend: split header into I/O and global state (GS) API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 05/31] block-backend: special comments for blk_set/get_perm due to fuse,
Emanuele Giuseppe Esposito <=
- [PATCH v5 03/31] assertions for block global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 06/31] block/block-backend.c: assertions for block-backend, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 02/31] include/block/block: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 10/31] block.c: modify .attach and .detach callbacks of child_of_bds, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 08/31] assertions for block_int global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 09/31] block: introduce assert_bdrv_graph_writable, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 07/31] include/block/block_int: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 12/31] assertions for blockjob_int.h, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 13/31] block.c: add assertions to static functions, Emanuele Giuseppe Esposito, 2021/11/24
- [PATCH v5 11/31] include/block/blockjob_int.h: split header into I/O and GS API, Emanuele Giuseppe Esposito, 2021/11/24