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>
This commit is contained in:
Jens Axboe
2019-03-05 20:12:48 -07:00
parent b080d0680c
commit 8260029608

View File

@@ -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;
}
/*