mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
io_uring/futex: don't mark futex wake requests as inflight
Commit079afb081c("io_uring/futex: mark wait requests as inflight") added inflight tracking to ensure that do_exit() -> io_uring_files_cancel() finds and cancels pending futex waits before the mm goes away, as a private futex wait depends on the mm private futex hash staying alive for the duration of the request. However, as io_futex_prep() is shared between FUTEX_WAIT and FUTEX_WAKE, wake requests got marked as inflight as well. A futex wake executes fully inline at issue time and never depends on the mm staying alive after completion, hence there's no need to track it. Kill it. Cc: stable@vger.kernel.org Fixes:079afb081c("io_uring/futex: mark wait requests as inflight") Reported-by: Chengfeng Lin <lin2530632123@gmail.com> Link: https://lore.kernel.org/io-uring/CANGjgdn=R_qyUdE=j9za+vkmqcxacbP-84OHXF4nZ4ho9qRyVg@mail.gmail.com/ Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -149,6 +149,17 @@ int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
!futex_validate_input(iof->futex_flags, iof->futex_mask))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int io_futex_wait_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = io_futex_prep(req, sqe);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
/* Mark as inflight, so file exit cancelation will find it */
|
||||
io_req_track_inflight(req);
|
||||
return 0;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "cancel.h"
|
||||
|
||||
int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
|
||||
int io_futex_wait_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
|
||||
int io_futexv_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
|
||||
int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags);
|
||||
int io_futexv_wait(struct io_kiocb *req, unsigned int issue_flags);
|
||||
|
||||
+1
-1
@@ -467,7 +467,7 @@ const struct io_issue_def io_issue_defs[] = {
|
||||
},
|
||||
[IORING_OP_FUTEX_WAIT] = {
|
||||
#if defined(CONFIG_FUTEX)
|
||||
.prep = io_futex_prep,
|
||||
.prep = io_futex_wait_prep,
|
||||
.issue = io_futex_wait,
|
||||
#else
|
||||
.prep = io_eopnotsupp_prep,
|
||||
|
||||
Reference in New Issue
Block a user