diff mbox series

[4/4] fuse: {io-uring} Use {WRITE,READ}_ONCE for pdu->ent

Message ID 20250124-optimize-fuse-uring-req-timeouts-v1-4-b834b5f32e85@ddn.com (mailing list archive)
State New
Headers show
Series fuse: {io-uring} Ensure fuse requests are set/read with locks | expand

Commit Message

Bernd Schubert Jan. 24, 2025, 4:46 p.m. UTC
This is set and read by different threads, we better use
_ONCE.

Fixes: 284985711dc5 ("fuse: Allow to queue fg requests through io-uring")
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
 fs/fuse/dev_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index c958701d4343705015abe2812e5030a9816346c3..c4453352a0c1c0aef387caf45bae21eaae0918ef 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -36,7 +36,7 @@  static void uring_cmd_set_ring_ent(struct io_uring_cmd *cmd,
 	struct fuse_uring_pdu *pdu =
 		io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu);
 
-	pdu->ent = ring_ent;
+	WRITE_ONCE(pdu->ent, ring_ent);
 }
 
 static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd)
@@ -44,7 +44,7 @@  static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd)
 	struct fuse_uring_pdu *pdu =
 		io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu);
 
-	return pdu->ent;
+	return READ_ONCE(pdu->ent);
 }
 
 static void fuse_uring_flush_bg(struct fuse_ring_queue *queue)