io_uring: fix short read retries for non-reg files
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 21 Jan 2021 12:01:08 +0000 (12:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jan 2021 10:55:15 +0000 (11:55 +0100)
commit2df15ef2a9cc58142d7acf1393db3fe5434f44c2
tree09b51b7856d1ebfc61470644ce144f6534274345
parentf3ac7a5996d7cd739664c5f71cab4f8da03937e7
io_uring: fix short read retries for non-reg files

commit 9a173346bd9e16ab19c7addb8862d95a5cea9feb upstream.

Sockets and other non-regular files may actually expect short reads to
happen, don't retry reads for them. Because non-reg files don't set
FMODE_BUF_RASYNC and so it won't do second/retry do_read, we can filter
out those cases after first do_read() attempt with ret>0.

Cc: stable@vger.kernel.org # 5.9+
Suggested-by: Jens Axboe <axboe@kernel.dk>
Signed-off-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