From 8260029608b9650c9d230e9668935de7862dc845 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 5 Mar 2019 20:12:48 -0700 Subject: queue: ensure io_uring_submit() returns the right error We weren't passing back -errno for the system call failure. This meant any error got turned into EPERM as far as the caller was concerned. Signed-off-by: Jens Axboe --- src/queue.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/queue.c b/src/queue.c index 76e6edc..07bd81d 100644 --- a/src/queue.c +++ b/src/queue.c @@ -81,6 +81,7 @@ int io_uring_submit(struct io_uring *ring) struct io_uring_sq *sq = &ring->sq; const unsigned mask = *sq->kring_mask; unsigned ktail, ktail_next, submitted; + int ret; /* * If we have pending IO in the kring, submit it first. We need a @@ -132,8 +133,12 @@ int io_uring_submit(struct io_uring *ring) } submit: - return io_uring_enter(ring->ring_fd, submitted, 0, + ret = io_uring_enter(ring->ring_fd, submitted, 0, IORING_ENTER_GETEVENTS, NULL); + if (ret < 0) + return -errno; + + return 0; } /* -- cgit