]> www.infradead.org Git - users/willy/xarray.git/commitdiff
io_uring/sqpoll: ensure that normal task_work is also run timely
authorJens Axboe <axboe@kernel.dk>
Tue, 21 May 2024 18:31:12 +0000 (12:31 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 May 2024 19:41:14 +0000 (13:41 -0600)
With the move to private task_work, SQPOLL neglected to also run the
normal task_work, if any is pending. This will eventually get run, but
we should run it with the private task_work to ensure that things like
a final fput() is processed in a timely fashion.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/313824bc-799d-414f-96b7-e6de57c7e21d@gmail.com/
Reported-by: Andrew Udvare <audvare@gmail.com>
Fixes: af5d68f8892f ("io_uring/sqpoll: manage task_work privately")
Tested-by: Christian Heusel <christian@heusel.eu>
Tested-by: Andrew Udvare <audvare@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/sqpoll.c

index 554c7212aa4631664f04184d2b3fc6e2b14a4085..b3722e5275e77e632529dedfb4285f3adfa07537 100644 (file)
@@ -238,11 +238,13 @@ static unsigned int io_sq_tw(struct llist_node **retry_list, int max_entries)
        if (*retry_list) {
                *retry_list = io_handle_tw_list(*retry_list, &count, max_entries);
                if (count >= max_entries)
-                       return count;
+                       goto out;
                max_entries -= count;
        }
-
        *retry_list = tctx_task_work_run(tctx, max_entries, &count);
+out:
+       if (task_work_pending(current))
+               task_work_run();
        return count;
 }