public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: juanlu@fastmail.com
Subject: [PATCHSET] Cancel requests at ring close time
Date: Wed,  9 Sep 2026 08:06:10 -0600	[thread overview]
Message-ID: <20260909141010.21064-1-axboe@kernel.dk> (raw)

Hi,

As it stands, io_uring cancels requests in an async fashion when the
ring fd is closed. This can cause some application confusion, if the
application expects files to be fully closed by the time close(2) of the
ring fd returns. We've had reports before where someone doing IO to
/mnt/file, closes the ring and then attempts a umount, and gets -EBUSY
on the umount. Or more recently from the TigerBeetle folks, where their
shutdown is a backend kill, and that still ends up with file locks being
active until the background cancelations have been run.

This series attempts to make that more predictable, by canceling
everything sync, upfront, when the ring fd is closed.

Series can also be found here:

https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git/log/?h=io_uring-exit-cancel.4

 include/linux/io_uring_types.h |   2 +
 io_uring/cancel.c              |  89 +++++++++++++---
 io_uring/cancel.h              |  13 ++-
 io_uring/io_uring.c            | 180 ++++++++++++++++++++++++++-------
 io_uring/notif.c               |   2 +
 io_uring/timeout.c             |  18 ++++
 io_uring/timeout.h             |   2 +
 io_uring/uring_cmd.c           |   4 +-
 io_uring/uring_cmd.h           |   2 +-
 9 files changed, 260 insertions(+), 52 deletions(-)

-- 
Jens Axboe


             reply	other threads:[~2026-09-09 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 14:06 Jens Axboe [this message]
2026-09-09 14:06 ` [PATCH 1/7] io_uring/uring_cmd: only cancel requests of the given task Jens Axboe
2026-09-09 14:06 ` [PATCH 2/7] io_uring/notif: count pending zerocopy notifications per ring Jens Axboe
2026-09-09 14:06 ` [PATCH 3/7] io_uring/cancel: cancel and wait for all requests on process exit Jens Axboe
2026-09-09 14:06 ` [PATCH 4/7] io_uring: run cancelations synchronously on ring release Jens Axboe
2026-09-09 14:06 ` [PATCH 5/7] io_uring: drop registered files and buffers at release time Jens Axboe
2026-09-09 14:06 ` [PATCH 6/7] io_uring: wait for in-flight requests on ring release Jens Axboe
2026-09-09 14:06 ` [PATCH 7/7] io_uring/io-wq: put the request file before posting a completion Jens Axboe

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 \
    --in-reply-to=20260909141010.21064-1-axboe@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=juanlu@fastmail.com \
    /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