From: Jens Axboe <axboe@kernel.dk>
To: yangerkun <yangerkun@huawei.com>, linux-block@vger.kernel.org
Cc: yi.zhang@huawei.com, houtao1@huawei.com
Subject: Re: [PATCH V3] io_uring: consider the overflow of sequence for timeout req
Date: Tue, 15 Oct 2019 08:52:11 -0600 [thread overview]
Message-ID: <d0561a29-14aa-c915-c99d-8bbb2f7740e0@kernel.dk> (raw)
In-Reply-To: <20191015135929.30912-1-yangerkun@huawei.com>
On 10/15/19 7:59 AM, yangerkun wrote:
> Now we recalculate the sequence of timeout with 'req->sequence =
> ctx->cached_sq_head + count - 1', judge the right place to insert
> for timeout_list by compare the number of request we still expected for
> completion. But we have not consider about the situation of overflow:
>
> 1. ctx->cached_sq_head + count - 1 may overflow. And a bigger count for
> the new timeout req can have a small req->sequence.
>
> 2. cached_sq_head of now may overflow compare with before req. And it
> will lead the timeout req with small req->sequence.
>
> This overflow will lead to the misorder of timeout_list, which can lead
> to the wrong order of the completion of timeout_list. Fix it by reuse
> req->submit.sequence to store the count, and change the logic of
> inserting sort in io_timeout.
Thanks, this looks great. Applied for 5.4.
--
Jens Axboe
next prev parent reply other threads:[~2019-10-15 14:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 13:59 [PATCH V3] io_uring: consider the overflow of sequence for timeout req yangerkun
2019-10-15 14:52 ` Jens Axboe [this message]
2019-10-16 1:35 ` yangerkun
2019-10-16 1:45 ` Jens Axboe
2019-10-16 2:19 ` yangerkun
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=d0561a29-14aa-c915-c99d-8bbb2f7740e0@kernel.dk \
--to=axboe@kernel.dk \
--cc=houtao1@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).