]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
io_uring: fix up O_NONBLOCK handling for sockets
authorJens Axboe <axboe@kernel.dk>
Thu, 17 Oct 2019 15:20:46 +0000 (09:20 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 17:47:04 +0000 (18:47 +0100)
commit5486efbf940b04fe8a34c7256c75ff2244a43f86
tree174ab100cf8efa810b72fea644c703d3660b2096
parent3293e7e988467bdd1403c91f39fbf0a44728dbf2
io_uring: fix up O_NONBLOCK handling for sockets

BugLink: https://bugs.launchpad.net/bugs/1851550
[ Upstream commit 491381ce07ca57f68c49c79a8a43da5b60749e32 ]

We've got two issues with the non-regular file handling for non-blocking
IO:

1) We don't want to re-do a short read in full for a non-regular file,
   as we can't just read the data again.
2) For non-regular files that don't support non-blocking IO attempts,
   we need to punt to async context even if the file is opened as
   non-blocking. Otherwise the caller always gets -EAGAIN.

Add two new request flags to handle these cases. One is just a cache
of the inode S_ISREG() status, the other tells io_uring that we always
need to punt this request to async context, even if REQ_F_NOWAIT is set.

Cc: stable@vger.kernel.org
Reported-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Tested-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/io_uring.c