Skip to content

Commit

Permalink
Merge tag 'io_uring-5.12-2021-03-19' of git://git.kernel.dk/linux-block
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Mar 20, 2021
2 parents ecd8ee7 + de75a3d commit 0ada2da
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 130 deletions.
6 changes: 5 additions & 1 deletion fs/io-wq.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ static int io_wqe_worker(void *data)
set_task_comm(current, buf);

while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) {
long ret;

set_current_state(TASK_INTERRUPTIBLE);
loop:
raw_spin_lock_irq(&wqe->lock);
Expand All @@ -498,7 +500,8 @@ static int io_wqe_worker(void *data)
__io_worker_idle(wqe, worker);
raw_spin_unlock_irq(&wqe->lock);
io_flush_signals();
if (schedule_timeout(WORKER_IDLE_TIMEOUT))
ret = schedule_timeout(WORKER_IDLE_TIMEOUT);
if (try_to_freeze() || ret)
continue;
if (fatal_signal_pending(current))
break;
Expand Down Expand Up @@ -709,6 +712,7 @@ static int io_wq_manager(void *data)
set_current_state(TASK_INTERRUPTIBLE);
io_wq_check_workers(wq);
schedule_timeout(HZ);
try_to_freeze();
if (fatal_signal_pending(current))
set_bit(IO_WQ_BIT_EXIT, &wq->state);
} while (!test_bit(IO_WQ_BIT_EXIT, &wq->state));
Expand Down
10 changes: 9 additions & 1 deletion fs/io-wq.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define INTERNAL_IO_WQ_H

#include <linux/refcount.h>
#include <linux/io_uring.h>

struct io_wq;

Expand All @@ -21,6 +20,15 @@ enum io_wq_cancel {
IO_WQ_CANCEL_NOTFOUND, /* work not found */
};

struct io_wq_work_node {
struct io_wq_work_node *next;
};

struct io_wq_work_list {
struct io_wq_work_node *first;
struct io_wq_work_node *last;
};

static inline void wq_list_add_after(struct io_wq_work_node *node,
struct io_wq_work_node *pos,
struct io_wq_work_list *list)
Expand Down
Loading

0 comments on commit 0ada2da

Please sign in to comment.