]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: return an error when cqe is dropped
authorDylan Yudaken <dylany@fb.com>
Thu, 21 Apr 2022 09:13:44 +0000 (02:13 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Apr 2022 00:18:18 +0000 (18:18 -0600)
commit28235a1a40f6adab012b7aa066eee8df99920535
tree83ed320d4eb291088416417c25da076b249681e5
parentbdf60a60f279190ef6f22dec399e933b65aa2c85
io_uring: return an error when cqe is dropped

Right now io_uring will not actively inform userspace if a CQE is
dropped. This is extremely rare, requiring a CQ ring overflow, as well as
a GFP_ATOMIC kmalloc failure. However the consequences could cause for
example applications to go into an undefined state, possibly waiting for a
CQE that never arrives.

Return an error code (EBADR) in these cases. Since this is expected to be
incredibly rare, try and avoid as much as possible affecting the hot code
paths, and so it only is returned lazily and when there is no other
available CQEs.

Once the error is returned, reset the error condition assuming the user is
either ok with it or will clean up appropriately.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220421091345.2115755-6-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c