From: Jiufei Xue Date: Wed, 10 Jun 2020 05:41:59 +0000 (+0800) Subject: io_uring: check file O_NONBLOCK state for accept X-Git-Tag: v5.8-rc1~36^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e697deed834de15d2322d0619d51893022c90ea2;p=thirdparty%2Flinux.git io_uring: check file O_NONBLOCK state for accept If the socket is O_NONBLOCK, we should complete the accept request with -EAGAIN when data is not ready. Signed-off-by: Jiufei Xue Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index d72b2a9463cad..5b0249140ff59 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3909,6 +3909,9 @@ static int io_accept(struct io_kiocb *req, bool force_nonblock) unsigned int file_flags = force_nonblock ? O_NONBLOCK : 0; int ret; + if (req->file->f_flags & O_NONBLOCK) + req->flags |= REQ_F_NOWAIT; + ret = __sys_accept4_file(req->file, file_flags, accept->addr, accept->addr_len, accept->flags, accept->nofile);