public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: [email protected]
Subject: [PATCHSET] Improve io_uring cancellations
Date: Wed, 13 Nov 2019 12:43:53 -0700	[thread overview]
Message-ID: <[email protected]> (raw)

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



             reply	other threads:[~2019-11-13 19:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 19:43 Jens Axboe [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox