summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-03-05 20:12:48 -0700
committerJens Axboe <axboe@kernel.dk>2019-03-05 20:12:48 -0700
commit8260029608b9650c9d230e9668935de7862dc845 (patch)
tree2a45748c78fe94a76e3fe7d69dde2b498ff7b43d /src
parentb080d0680c0aac5dad408a5711d65e4606295cb2 (diff)
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 <axboe@kernel.dk>
Diffstat (limited to 'src')
-rw-r--r--src/queue.c7
1 files changed, 6 insertions, 1 deletions
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;
}
/*