From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Yu Kuai <yukuai1@huaweicloud.com>, song@kernel.org
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH -next] raid10: fix leak of io accounting
Date: Thu, 9 Mar 2023 15:27:04 +0800 [thread overview]
Message-ID: <fbbb46dc-ac07-9a99-dece-f0077a9fd491@linux.dev> (raw)
In-Reply-To: <76d32496-641e-c93a-df77-9ce9d9c1a1e1@huaweicloud.com>
On 3/9/23 14:56, Yu Kuai wrote:
> Hi,
>
> 在 2023/03/09 14:36, Guoqing Jiang 写道:
>> Hi,
>>
>> What do you mean 'leak' here?
>
> I try to mean that inflight counting is leaked, because it's increased
> twice for one io.
How about change the subject to something like?
'md/raid10: Don't call bio_start_io_acct twice for bio which experienced
read error'
>
>>
>> On 3/4/23 15:01, Yu Kuai wrote:
>>> From: Yu Kuai <yukuai3@huawei.com>
>>>
>>> handle_read_error() will resumit r10_bio by raid10_read_request(),
>>> which
>>> will call bio_start_io_acct() again, while bio_end_io_acct() will only
>>> be called once.
>>>
>>> Fix the problem by don't account io again from handle_read_error().
>>
>> My understanding is it caused inaccurate io stats for bio which had a
>> read
>> error.
>>
>>> Fixes: 528bc2cf2fcc ("md/raid10: enable io accounting")
>>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>>> ---
>>> drivers/md/raid10.c | 8 ++++----
>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
>>> index 6c66357f92f5..4f8edb6ea3e2 100644
>>> --- a/drivers/md/raid10.c
>>> +++ b/drivers/md/raid10.c
>>> @@ -1173,7 +1173,7 @@ static bool regular_request_wait(struct mddev
>>> *mddev, struct r10conf *conf,
>>> }
>>> static void raid10_read_request(struct mddev *mddev, struct bio *bio,
>>> - struct r10bio *r10_bio)
>>> + struct r10bio *r10_bio, bool handle_error)
>>> {
>>> struct r10conf *conf = mddev->private;
>>> struct bio *read_bio;
>>> @@ -1244,7 +1244,7 @@ static void raid10_read_request(struct mddev
>>> *mddev, struct bio *bio,
>>> }
>>> slot = r10_bio->read_slot;
>>> - if (blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
>>> + if (!handle_error &&
>>> blk_queue_io_stat(bio->bi_bdev->bd_disk->queue))
>>> r10_bio->start_time = bio_start_io_acct(bio);
>>
>> I think a simpler way is just check R10BIO_ReadError here.
>
> No, I'm afraid this is incorrect because handle_read_error clears the
> state before resubmiting the r10bio.
Right,
Acked-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Thanks,
Guoqing
next prev parent reply other threads:[~2023-03-09 7:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-04 7:01 [PATCH -next] raid10: fix leak of io accounting Yu Kuai
2023-03-09 6:36 ` Guoqing Jiang
2023-03-09 6:56 ` Yu Kuai
2023-03-09 7:27 ` Guoqing Jiang [this message]
2023-03-09 7:45 ` Yu Kuai
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=fbbb46dc-ac07-9a99-dece-f0077a9fd491@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@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