]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block/io_uring: improve error message when init fails
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 23 Jan 2024 13:50:44 +0000 (14:50 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 30 Jan 2024 21:13:28 +0000 (16:13 -0500)
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>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240123135044.204985-1-f.ebner@proxmox.com>

block/io_uring.c

index d77ae55745a9e71fd60cde87504c2609b517e387..d11b2051abde780e3f50d9e613dacd19fec33ddf 100644 (file)
@@ -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;
     }