io_uring: only call io_cqring_ev_posted() if events were posted
authorJens Axboe <axboe@kernel.dk>
Sun, 24 Jan 2021 23:58:56 +0000 (16:58 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 25 Jan 2021 01:13:56 +0000 (18:13 -0700)
commitb18032bb0a883cd7edd22a7fe6c57e1059b81ed0
treec42ad53c60d1696372582e41fd7354d867ff4188
parent84965ff8a84f0368b154c9b367b62e59c1193f30
io_uring: only call io_cqring_ev_posted() if events were posted

This normally doesn't cause any extra harm, but it does mean that we'll
increment the eventfd notification count, if one has been registered
with the ring. This can confuse applications, when they see more
notifications on the eventfd side than are available in the ring.

Do the nice thing and only increment this count, if we actually posted
(or even overflowed) events.

Reported-and-tested-by: Dan Melnic <dmm@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c