From f4c5d20772145c02f8e78176ae9d6cb6f60c6cfa Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Mon, 16 Jun 2025 15:28:26 +0200 Subject: Fix io-uring teardown We need to write an uint64_t to eventfd. Signed-off-by: Bernd Schubert --- lib/fuse_uring.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/fuse_uring.c') diff --git a/lib/fuse_uring.c b/lib/fuse_uring.c index fb5cd8f..33f8f56 100644 --- a/lib/fuse_uring.c +++ b/lib/fuse_uring.c @@ -345,9 +345,15 @@ static void fuse_session_destruct_uring(struct fuse_ring_pool *fuse_ring) fuse_uring_get_queue(fuse_ring, qid); if (queue->tid != 0) { - int value = 1; - - write(queue->eventfd, &value, sizeof(value)); + uint64_t value = 1ULL; + int rc; + + rc = write(queue->eventfd, &value, sizeof(value)); + if (rc != sizeof(value)) + fprintf(stderr, + "Wrote to eventfd=%d err=%s: rc=%d\n", + queue->eventfd, strerror(errno), rc); + pthread_cancel(queue->tid); pthread_join(queue->tid, NULL); queue->tid = 0; } @@ -416,7 +422,7 @@ static int fuse_uring_prepare_fetch_sqes(struct fuse_ring_queue *queue) return -EINVAL; } - // Add the poll SQE for the eventfd to wake up on teardown + /* Poll SQE for the eventfd to wake up on teardown */ sqe = io_uring_get_sqe(&queue->ring); if (sqe == NULL) { fuse_log(FUSE_LOG_ERR, "Failed to get eventfd SQE"); -- cgit v1.2.3