From: Mark Harmstone <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: Mark Harmstone <[email protected]>,
Pavel Begunkov <[email protected]>
Subject: [PATCH] btrfs: check if task has died in btrfs_uring_read_finished()
Date: Fri, 13 Dec 2024 12:46:15 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
If the task has died by the time we call btrfs_uring_read_finished(),
return -ECANCELED rather than trying to copy the pages back to
userspace.
Signed-off-by: Mark Harmstone <[email protected]>
Suggested-by: Pavel Begunkov <[email protected]>
---
(This is quite possibly a resend. I intended this to be the sequel to
"[PATCH 1/2] io_uring/cmd: let cmds to know about dying task", but I
can't find it anywhere on the mailing lists now.)
fs/btrfs/ioctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 64cebc32fe76..6913967083fe 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4754,6 +4754,11 @@ static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int iss
/* The inode lock has already been acquired in btrfs_uring_read_extent. */
btrfs_lockdep_inode_acquire(inode, i_rwsem);
+ if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) {
+ ret = -ECANCELED;
+ goto out;
+ }
+
if (priv->err) {
ret = priv->err;
goto out;
--
2.45.2
reply other threads:[~2024-12-13 12:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox