Re: [PATCH 5/5] io_uring: implement multishot mode for accept

From: Jens Axboe
Date: Fri May 06 2022 - 17:29:33 EST


On 5/6/22 2:50 PM, Jens Axboe wrote:
> On 5/6/22 1:01 AM, Hao Xu wrote:
>> @@ -5748,8 +5758,12 @@ static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
>> if (!fixed)
>> put_unused_fd(fd);
>> ret = PTR_ERR(file);
>> - if (ret == -EAGAIN && force_nonblock)
>> - return -EAGAIN;
>> + if (ret == -EAGAIN && force_nonblock) {
>> + if ((req->flags & REQ_F_APOLL_MULTI_POLLED) ==
>> + REQ_F_APOLL_MULTI_POLLED)
>> + ret = 0;
>> + return ret;
>
> FWIW, this
>
> if ((req->flags & REQ_F_APOLL_MULTI_POLLED) == REQ_F_APOLL_MULTI_POLLED)
>
> is identical to
>
> if (req->flags & REQ_F_APOLL_MULTI_POLLED)
>
> but I suspect this used to check more flags (??), because as it stands
> it seems a bit nonsensical.

Looking deeper, it is indeed a mask and not a single flag! So the check
looks fine.

--
Jens Axboe