2022-05-09 07:44:46

by Jens Axboe

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

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.

--
Jens Axboe



2022-05-09 09:48:37

by Jens Axboe

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

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