Skip to content

Commit 172edde

Browse files
committed
Merge tag 'io_uring-5.7-2020-04-09' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe: "Here's a set of fixes that either weren't quite ready for the first, or came about from some intensive testing on memcached with 350K+ sockets. Summary: - Fixes for races or deadlocks around poll handling - Don't double account fixed files against RLIMIT_NOFILE - IORING_OP_OPENAT LFS fix - Poll retry handling (Bijan) - Missing finish_wait() for SQPOLL (Hillf) - Cleanup/split of io_kiocb alloc vs ctx references (Pavel) - Fixed file unregistration and init fixes (Xiaoguang) - Various little fixes (Xiaoguang, Pavel, Colin)" * tag 'io_uring-5.7-2020-04-09' of git://git.kernel.dk/linux-block: io_uring: punt final io_ring_ctx wait-and-free to workqueue io_uring: fix fs cleanup on cqe overflow io_uring: don't read user-shared sqe flags twice io_uring: remove req init from io_get_req() io_uring: alloc req only after getting sqe io_uring: simplify io_get_sqring io_uring: do not always copy iovec in io_req_map_rw() io_uring: ensure openat sets O_LARGEFILE if needed io_uring: initialize fixed_file_data lock io_uring: remove redundant variable pointer nxt and io_wq_assign_next call io_uring: fix ctx refcounting in io_submit_sqes() io_uring: process requests completed with -EAGAIN on poll list io_uring: remove bogus RLIMIT_NOFILE check in file registration io_uring: use io-wq manager as backup task if task is exiting io_uring: grab task reference for poll requests io_uring: retry poll if we got woken with non-matching mask io_uring: add missing finish_wait() in io_sq_thread() io_uring: refactor file register/unregister/update handling
2 parents 8c3c074 + 85faa7b commit 172edde

File tree

3 files changed

+269
-173
lines changed

3 files changed

+269
-173
lines changed

fs/io-wq.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/kthread.h>
1818
#include <linux/rculist_nulls.h>
1919
#include <linux/fs_struct.h>
20+
#include <linux/task_work.h>
2021

2122
#include "io-wq.h"
2223

@@ -716,6 +717,9 @@ static int io_wq_manager(void *data)
716717
complete(&wq->done);
717718

718719
while (!kthread_should_stop()) {
720+
if (current->task_works)
721+
task_work_run();
722+
719723
for_each_node(node) {
720724
struct io_wqe *wqe = wq->wqes[node];
721725
bool fork_worker[2] = { false, false };
@@ -738,6 +742,9 @@ static int io_wq_manager(void *data)
738742
schedule_timeout(HZ);
739743
}
740744

745+
if (current->task_works)
746+
task_work_run();
747+
741748
return 0;
742749
err:
743750
set_bit(IO_WQ_BIT_ERROR, &wq->state);
@@ -1124,3 +1131,8 @@ void io_wq_destroy(struct io_wq *wq)
11241131
if (refcount_dec_and_test(&wq->use_refs))
11251132
__io_wq_destroy(wq);
11261133
}
1134+
1135+
struct task_struct *io_wq_get_task(struct io_wq *wq)
1136+
{
1137+
return wq->manager;
1138+
}

fs/io-wq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ typedef bool (work_cancel_fn)(struct io_wq_work *, void *);
136136
enum io_wq_cancel io_wq_cancel_cb(struct io_wq *wq, work_cancel_fn *cancel,
137137
void *data);
138138

139+
struct task_struct *io_wq_get_task(struct io_wq *wq);
140+
139141
#if defined(CONFIG_IO_WQ)
140142
extern void io_wq_worker_sleeping(struct task_struct *);
141143
extern void io_wq_worker_running(struct task_struct *);

0 commit comments

Comments
 (0)