io_uring: fix bad inflight accounting for SETUP_IOPOLL|SETUP_SQTHREAD
authorJens Axboe <axboe@kernel.dk>
Fri, 25 Oct 2019 16:06:15 +0000 (10:06 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2019 08:22:03 +0000 (09:22 +0100)
commitab03d9b7899ee979ee99b66e9cb42c065da08769
tree6715daddeeff6a2c8628e15ffe4320e6fb1f00e7
parent35b0eff1997f6783085e7d43e199ebafcda63650
io_uring: fix bad inflight accounting for SETUP_IOPOLL|SETUP_SQTHREAD

commit 2b2ed9750fc9d040b9f6d076afcef6f00b6f1f7c upstream.

We currently assume that submissions from the sqthread are successful,
and if IO polling is enabled, we use that value for knowing how many
completions to look for. But if we overflowed the CQ ring or some
requests simply got errored and already completed, they won't be
available for polling.

For the case of IO polling and SQTHREAD usage, look at the pending
poll list. If it ever hits empty then we know that we don't have
anymore pollable requests inflight. For that case, simply reset
the inflight count to zero.

Reported-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c