Commit Graph

5 Commits

Author SHA1 Message Date
Jens Axboe
76b61ebf1b Add io_uring_cqe_seen()
There's a failure case where an application gets a cqe entry, but
the kernel can then overwrite it before the application is done
reading it. This can happen since the io_uring_{get,wait}_completion()
interface both returns a CQE pointer AND increments the ring index.
If the kernel reuses this entry before the applications is done reading
it, the contents may be corrupted.

Remove the CQ head increment from the CQE retrieval, and put it into
a separate helper, io_uring_cqe_seen(). The application must call this
helper when it got a new CQE entry through one of the above calls, and
it's now done reading it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-17 09:42:23 -06:00
Jens Axboe
093e902c28 test/fsync: error out if we submit less than we wanted
This failure is expected on kernels that don't support the DRAIN
primitive.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-11 09:00:47 -06:00
Jens Axboe
9864409788 test/fsync: update for IOSQE_IO_DRAIN approach
I generalized the barrier flag to be applicable to all commands, so
let's drop the fsync special flag.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-10 21:56:54 -06:00
Jens Axboe
61c27f73f8 Add barrier fsync test case
Also changes the fsync prep helper to require passing in the actual
flag, not just a boolean for fsync vs fdatasync.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-06 21:50:15 -06:00
Jens Axboe
6726376f32 test/fsync: add simple fsync tester
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 21:02:00 -07:00