io_uring: use original request task for inflight tracking
authorJens Axboe <axboe@kernel.dk>
Thu, 23 Jun 2022 17:06:43 +0000 (11:06 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:17:47 +0000 (15:17 +0200)
commit 386e4fb6962b9f248a80f8870aea0870ca603e89 upstream.

In prior kernels, we did file assignment always at prep time. This meant
that req->task == current. But after deferring that assignment and then
pushing the inflight tracking back in, we've got the inflight tracking
using current when it should in fact now be using req->task.

Fixup that error introduced by adding the inflight tracking back after
file assignments got modifed.

Fixes: 9cae36a094e7 ("io_uring: reinstate the inflight tracking")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c

index 0ce1587df4322101ccae9dbe492c91dc6602def2..89f24b54fe5e8db7c8ed1b2e8dbbdbfb677a58a6 100644 (file)
@@ -1405,7 +1405,7 @@ static void io_req_track_inflight(struct io_kiocb *req)
 {
        if (!(req->flags & REQ_F_INFLIGHT)) {
                req->flags |= REQ_F_INFLIGHT;
-               atomic_inc(&current->io_uring->inflight_tracked);
+               atomic_inc(&req->task->io_uring->inflight_tracked);
        }
 }