qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/io_uring: improve error message when init fails
@ 2024-01-23 13:50 Fiona Ebner
  2024-01-23 14:01 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2024-01-23 13:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, hreitz, kwolf, sgarzare, stefanha, jusual,
	mehta.aaru20

The man page for io_uring_queue_init states:

> io_uring_queue_init(3) returns 0 on success and -errno on failure.

and the man page for io_uring_setup (which is one of the functions
where the return value of io_uring_queue_init() can come from) states:

> On error, a negative error code is returned. The caller should not
> rely on errno variable.

Tested using 'sysctl kernel.io_uring_disabled=2'. Output before this
change:

> failed to init linux io_uring ring

Output after this change:

> failed to init linux io_uring ring: Operation not permitted

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 block/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/io_uring.c b/block/io_uring.c
index d77ae55745..d11b2051ab 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -432,7 +432,7 @@ LuringState *luring_init(Error **errp)
 
     rc = io_uring_queue_init(MAX_ENTRIES, ring, 0);
     if (rc < 0) {
-        error_setg_errno(errp, errno, "failed to init linux io_uring ring");
+        error_setg_errno(errp, -rc, "failed to init linux io_uring ring");
         g_free(s);
         return NULL;
     }
-- 
2.39.2




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

end of thread, other threads:[~2024-01-23 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 13:50 [PATCH] block/io_uring: improve error message when init fails Fiona Ebner
2024-01-23 14:01 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).