Skip to content

Commit 0ada2da

Browse files
committed
Merge tag 'io_uring-5.12-2021-03-19' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe: "Quieter week this time, which was both expected and desired. About half of the below is fixes for this release, the other half are just fixes in general. In detail: - Fix the freezing of IO threads, by making the freezer not send them fake signals. Make them freezable by default. - Like we did for personalities, move the buffer IDR to xarray. Kills some code and avoids a use-after-free on teardown. - SQPOLL cleanups and fixes (Pavel) - Fix linked timeout race (Pavel) - Fix potential completion post use-after-free (Pavel) - Cleanup and move internal structures outside of general kernel view (Stefan) - Use MSG_SIGNAL for send/recv from io_uring (Stefan)" * tag 'io_uring-5.12-2021-03-19' of git://git.kernel.dk/linux-block: io_uring: don't leak creds on SQO attach error io_uring: use typesafe pointers in io_uring_task io_uring: remove structures from include/linux/io_uring.h io_uring: imply MSG_NOSIGNAL for send[msg]()/recv[msg]() calls io_uring: fix sqpoll cancellation via task_work io_uring: add generic callback_head helpers io_uring: fix concurrent parking io_uring: halt SQO submission on ctx exit io_uring: replace sqd rw_semaphore with mutex io_uring: fix complete_post use ctx after free io_uring: fix ->flags races by linked timeouts io_uring: convert io_buffer_idr to XArray io_uring: allow IO worker threads to be frozen kernel: freezer should treat PF_IO_WORKER like PF_KTHREAD for freezing
2 parents ecd8ee7 + de75a3d commit 0ada2da

File tree

6 files changed

+142
-130
lines changed

6 files changed

+142
-130
lines changed

fs/io-wq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,8 @@ static int io_wqe_worker(void *data)
488488
set_task_comm(current, buf);
489489

490490
while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) {
491+
long ret;
492+
491493
set_current_state(TASK_INTERRUPTIBLE);
492494
loop:
493495
raw_spin_lock_irq(&wqe->lock);
@@ -498,7 +500,8 @@ static int io_wqe_worker(void *data)
498500
__io_worker_idle(wqe, worker);
499501
raw_spin_unlock_irq(&wqe->lock);
500502
io_flush_signals();
501-
if (schedule_timeout(WORKER_IDLE_TIMEOUT))
503+
ret = schedule_timeout(WORKER_IDLE_TIMEOUT);
504+
if (try_to_freeze() || ret)
502505
continue;
503506
if (fatal_signal_pending(current))
504507
break;
@@ -709,6 +712,7 @@ static int io_wq_manager(void *data)
709712
set_current_state(TASK_INTERRUPTIBLE);
710713
io_wq_check_workers(wq);
711714
schedule_timeout(HZ);
715+
try_to_freeze();
712716
if (fatal_signal_pending(current))
713717
set_bit(IO_WQ_BIT_EXIT, &wq->state);
714718
} while (!test_bit(IO_WQ_BIT_EXIT, &wq->state));

fs/io-wq.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define INTERNAL_IO_WQ_H
33

44
#include <linux/refcount.h>
5-
#include <linux/io_uring.h>
65

76
struct io_wq;
87

@@ -21,6 +20,15 @@ enum io_wq_cancel {
2120
IO_WQ_CANCEL_NOTFOUND, /* work not found */
2221
};
2322

23+
struct io_wq_work_node {
24+
struct io_wq_work_node *next;
25+
};
26+
27+
struct io_wq_work_list {
28+
struct io_wq_work_node *first;
29+
struct io_wq_work_node *last;
30+
};
31+
2432
static inline void wq_list_add_after(struct io_wq_work_node *node,
2533
struct io_wq_work_node *pos,
2634
struct io_wq_work_list *list)

0 commit comments

Comments
 (0)