From: Stefano Garzarella <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected],
Alexander Viro <[email protected]>,
[email protected], [email protected]
Subject: [PATCH for-next] io_uring: return EBADFD when ring isn't in the right state
Date: Tue, 8 Sep 2020 18:52:42 +0200 [thread overview]
Message-ID: <[email protected]> (raw)
This patch uniforms the returned error (EBADFD) when the ring state
(enabled/disabled) is not the expected one.
The changes affect io_uring_enter() and io_uring_register() syscalls.
Signed-off-by: Stefano Garzarella <[email protected]>
---
Hi Jens,
I also updated the test/register-restrictions in liburing here:
https://github.com/stefano-garzarella/liburing (branch: fix-disabled-ring-error)
Thanks,
Stefano
---
fs/io_uring.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 0490edfcdd88..cf5992e79d88 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8642,6 +8642,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
if (!percpu_ref_tryget(&ctx->refs))
goto out_fput;
+ ret = -EBADFD;
if (ctx->flags & IORING_SETUP_R_DISABLED)
goto out_fput;
@@ -9137,7 +9138,7 @@ static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
/* Restrictions allowed only if rings started disabled */
if (!(ctx->flags & IORING_SETUP_R_DISABLED))
- return -EINVAL;
+ return -EBADFD;
/* We allow only a single restrictions registration */
if (ctx->restrictions.registered)
@@ -9201,7 +9202,7 @@ static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
static int io_register_enable_rings(struct io_ring_ctx *ctx)
{
if (!(ctx->flags & IORING_SETUP_R_DISABLED))
- return -EINVAL;
+ return -EBADFD;
if (ctx->restrictions.registered)
ctx->restricted = 1;
--
2.26.2
next reply other threads:[~2020-09-08 16:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 16:52 Stefano Garzarella [this message]
2020-09-08 17:02 ` [PATCH for-next] io_uring: return EBADFD when ring isn't in the right state Jens Axboe
2020-09-09 7:09 ` Stefano Garzarella
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] \
[email protected] \
[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