aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_uring.c
diff options
context:
space:
mode:
authorBernd Schubert <bernd@bsbernd.com>2025-09-18 23:49:41 +0200
committerBernd Schubert <bernd@bsbernd.com>2025-09-19 22:48:11 +0200
commit50d1bec4794aae9e77062de5214b91bcc52a890d (patch)
treec32b7ee25722b0cdaea8d51d376ef45129ea67a7 /lib/fuse_uring.c
parent3e2cd9e46c87a57de374b82fd198328f7745e942 (diff)
downloadlibfuse-50d1bec4794aae9e77062de5214b91bcc52a890d.tar.gz
io-uring: re-initialize fields in struct fuse_req
In io-uring mode these requests are always re-used and not allocated - we need to re-initialize them. In order to set flags to zero a struct holding the flags had to be added. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
Diffstat (limited to 'lib/fuse_uring.c')
-rw-r--r--lib/fuse_uring.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/fuse_uring.c b/lib/fuse_uring.c
index 85b5a7f..2fea05f 100644
--- a/lib/fuse_uring.c
+++ b/lib/fuse_uring.c
@@ -197,7 +197,7 @@ int fuse_req_get_payload(fuse_req_t req, char **payload, size_t *payload_sz,
struct fuse_ring_ent *ring_ent;
/* Not possible without io-uring interface */
- if (!req->is_uring)
+ if (!req->flags.is_uring)
return -EINVAL;
ring_ent = container_of(req, struct fuse_ring_ent, req);
@@ -560,9 +560,13 @@ static void fuse_uring_handle_cqe(struct fuse_ring_queue *queue,
abort();
}
- req->is_uring = true;
+ memset(&req->flags, 0, sizeof(req->flags));
+ memset(&req->u, 0, sizeof(req->u));
+ req->flags.is_uring = 1;
req->ref_cnt++;
req->ch = NULL; /* not needed for uring */
+ req->interrupted = 0;
+ list_init_req(req);
fuse_session_process_uring_cqe(fuse_ring->se, req, in, &rrh->op_in,
ent->op_payload, ent_in_out->payload_sz);
@@ -696,8 +700,9 @@ static int fuse_uring_init_queue(struct fuse_ring_queue *queue)
req->se = se;
pthread_mutex_init(&req->lock, NULL);
- req->is_uring = true;
- req->ref_cnt = 1;
+ req->flags.is_uring = 1;
+ req->ref_cnt = 1; /* extra ref to avoid destruction */
+ list_init_req(req);
}
res = fuse_uring_prepare_fetch_sqes(queue);