diff mbox series

[RFC,v3,16/17] fuse: {uring} Handle IO_URING_F_TASK_DEAD

Message ID 20240901-b4-fuse-uring-rfcv3-without-mmap-v3-16-9207f7391444@ddn.com (mailing list archive)
State New
Headers show
Series fuse: fuse-over-io-uring | expand

Commit Message

Bernd Schubert Sept. 1, 2024, 1:37 p.m. UTC
The ring task is terminating, it not safe to still access
its resources. Also no need for further actions.

Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
 fs/fuse/dev_uring.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 43e7486d9f93..a65c5d08fce1 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -993,6 +993,9 @@  fuse_uring_send_req_in_task(struct io_uring_cmd *cmd,
 
 	BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu));
 
+	if (unlikely(issue_flags & IO_URING_F_TASK_DEAD))
+		goto terminating;
+
 	err = fuse_uring_prepare_send(ring_ent);
 	if (err)
 		goto err;
@@ -1007,6 +1010,10 @@  fuse_uring_send_req_in_task(struct io_uring_cmd *cmd,
 	return;
 err:
 	fuse_uring_next_fuse_req(ring_ent, queue);
+
+terminating:
+	/* Avoid all actions as the task that issues the ring is terminating */
+	io_uring_cmd_done(cmd, -ECANCELED, 0, issue_flags);
 }
 
 /* queue a fuse request and send it if a ring entry is available */