block/io_uring: improve error message when init fails
PATCH 1/1 block/io_uring: improve error message when init fails
The man page for io_uring_queue_init states:
Quoted 1 line
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:
Quoted 2 lines
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:
Quoted 1 line
failed to init linux
io_uringring
Output after this change:
Quoted 1 line
failed to init linux
io_uringring: Operation not permitted
--- block/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/io_uring.c +1 -1
@@ -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 ; }
Signature · 1 line
2.39.2
Stefan Hajnoczi
AppliedQuoted 15 lines · Fiona Ebner
The man page for
io_uring_queue_initstates:Quoted 1 line
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 ofio_uring_queue_init()can come from) states:Quoted 2 lines
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:
Quoted 1 line
failed to init linux
io_uringring
Quoted 8 lines
Output after this change:
Quoted 1 line
failed to init linux
io_uringring: Operation not permittedSigned-off-by Fiona Ebner <[email protected]>--- block/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my master tree:
https://gitlab.com/stefanha/qemu/commits/master
Stefan