All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] io_uring: fix hanging iopoll in case of -EAGAIN
Date: Tue, 23 Jun 2020 13:01:29 -0600	[thread overview]
Message-ID: <d33e9006-b7ef-4925-ff3f-332ab655f2ae@kernel.dk> (raw)
In-Reply-To: <6714cb8f-894c-9ff1-7b3a-4f86d7dbe52a@gmail.com>

On 6/23/20 5:57 AM, Pavel Begunkov wrote:
> On 23/06/2020 05:18, Jens Axboe wrote:
>> On 6/22/20 8:07 PM, Jens Axboe wrote:
>>> On 6/22/20 4:16 PM, Pavel Begunkov wrote:
>>>> io_do_iopoll() won't do anything with a request unless
>>>> req->iopoll_completed is set. So io_complete_rw_iopoll() has to set
>>>> it, otherwise io_do_iopoll() will poll a file again and again even
>>>> though the request of interest was completed long ago.
>>>
>>> I need to look at this again, because with this change, I previously
>>> got various use-after-free. I haven't seen any issues with it, but
>>> I agree, from a quick look that I'm not quite sure how it's currently
>>> not causing hangs. Yet I haven't seen any, with targeted -EAGAIN
>>> testing.
> 
> Can io_complete_rw_iopoll() get -EAGAIN after being successfully enqueued
> (i.e. EIOCBQUEUED)? It's reliably fails for me, because my hacked nullblk
> _can_ (i.e. probabilistically returns BLK_STS_AGAIN from ->iopoll()).

Yes it can. The primary example would be a polled bio that gets split, into
let's say 4 bio's. First one queues fine, but one of the subsequent ones
run into request allocation failures and it gets marked as -EAGAIN.

>> Ah I think I know what it is - if we run into:
>>
>> if (req->result == -EAGAIN)
>> 	return -EAGAIN
>>
>> in io_issue_sqe() and race with it, we'll reissue twice potentially.
>> So the above isn't quite enough, we'll need something a bit broader.
> 
> I see, I'll deal with it.

Thanks!

-- 
Jens Axboe


  reply	other threads:[~2020-06-23 19:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 22:16 [PATCH 0/4] iopoll fixes + cleanups Pavel Begunkov
2020-06-22 22:16 ` [PATCH 1/4] io_uring: fix hanging iopoll in case of -EAGAIN Pavel Begunkov
2020-06-23  2:07   ` Jens Axboe
2020-06-23  2:18     ` Jens Axboe
2020-06-23 11:57       ` Pavel Begunkov
2020-06-23 19:01         ` Jens Axboe [this message]
2020-06-24 16:56           ` Pavel Begunkov
2020-06-22 22:16 ` [PATCH 2/4] io_uring: handle EAGAIN iopoll Pavel Begunkov
2020-06-30  4:01   ` kernel test robot
2020-06-30  4:01     ` kernel test robot
2020-06-22 22:16 ` [PATCH 3/4] io-wq: compact io-wq flags numbers Pavel Begunkov
2020-06-22 22:16 ` [PATCH 4/4] io-wq: return next work from ->do_work() directly Pavel Begunkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d33e9006-b7ef-4925-ff3f-332ab655f2ae@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.