public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCHSET] Improve io_uring cancellations
@ 2019-11-13 19:43 Jens Axboe
  2019-11-13 19:43 ` [PATCH 1/2] io_wq: add get/put_work handlers to io_wq_create() Jens Axboe
  2019-11-13 19:43 ` [PATCH 2/2] io-wq: ensure task is valid before sending it a signal Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Jens Axboe @ 2019-11-13 19:43 UTC (permalink / raw)
  To: io-uring

We have a few issues currently:

- While the wqe->lock protects the stability of the worker->cur_work
  pointer, it does NOT stabilize the actual work item. For cancelling
  specific work, io_uring needs to dereference it to see if it matches.

- While we know the worker structure won't go away under the RCU read
  lock, the worker might exit. It's not safe to wake up or signal this
  process without ensuring it's still alive.

- We're not consistent in comparing worker->cur_work and sending a
  signal to cancel it.

These two patches fix the above issues. The first is a prep patch that
adds referencing of work items, which makes it safe to dereference
->cur_work if we ensure that ->cur_work itself is stable. The other
patch reworks how we ensure that tasks are alive for signaling, and
that we have a consistent view of ->cur_work while sending a signal.

We add a new lock for ->cur_work, as we cannot safely use wqe->lock
for this. See comment in patch 2 on signalfd usage.

 fs/io-wq.c    | 91 +++++++++++++++++++++++++++++++++++++--------------
 fs/io-wq.h    |  7 +++-
 fs/io_uring.c | 17 +++++++++-
 3 files changed, 89 insertions(+), 26 deletions(-)

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-13 19:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-13 19:43 [PATCHSET] Improve io_uring cancellations Jens Axboe
2019-11-13 19:43 ` [PATCH 1/2] io_wq: add get/put_work handlers to io_wq_create() Jens Axboe
2019-11-13 19:43 ` [PATCH 2/2] io-wq: ensure task is valid before sending it a signal Jens Axboe
2019-11-13 19:55   ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox