From: "yu kuai" <yukuai@fygo.io>
To: "Chen Cheng" <chencheng@fnnas.com>, <linux-raid@vger.kernel.org>,
"yu kuai" <yukuai@fygo.io>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] md/raid5: fix lockless max_nr_stripes reads
Date: Thu, 30 Jul 2026 16:59:20 +0800 [thread overview]
Message-ID: <079ff51d-fb2b-4064-b560-33ce2b9ededb@fygo.io> (raw)
In-Reply-To: <20260624024042.2561803-1-chencheng@fnnas.com>
在 2026/6/24 10:40, Chen Cheng 写道:
> From: Chen Cheng<chencheng@fnnas.com>
>
> max_nr_stripes is updated under cache_size_mutex in the stripe cache
> grow/shrink paths, while is_inactive_blocked() and
> raid5_end_read_request() read it without that lock.
>
> Use READ_ONCE() for those reads in lockless path to match the WRITE_ONCE()
> updates and avoid KCSAN data race reports.
>
> A similar issue was previously fixed in commit-id:
> dfd2bf436709b2bccb78c2dda550dde93700efa7.
>
> Fixes: 0009fad033370 ("raid5 improve too many read errors msg by adding limits")
> Fixes: 3514da58be9c4 ("md/raid5: Make is_inactive_blocked() helper")
>
> KCSAN report:
> =================
>
> BUG: KCSAN: data-race in grow_one_stripe / is_inactive_blocked
>
> write (marked) to 0xffff8f01f0b5a268 of 4 bytes by task 12616 on cpu 9:
> grow_one_stripe+0x2d8/0x320
> raid5d+0xb57/0xba0
> md_thread+0x15a/0x2d0
> [..........]
>
> read to 0xffff8f01f0b5a268 of 4 bytes by task 12670 on cpu 11:
> is_inactive_blocked+0x97/0xc0
> raid5_get_active_stripe+0x2fd/0xa70
> raid5_make_request+0x4aa/0x2940
> [..........]
>
> value changed: 0x000003b9 -> 0x000003ba
>
> Signed-off-by: Chen Cheng<chencheng@fnnas.com>
> ---
> drivers/md/raid5.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied to md-7.3
--
Thanks,
Kuai
prev parent reply other threads:[~2026-07-30 8:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 2:40 [PATCH] md/raid5: fix lockless max_nr_stripes reads Chen Cheng
2026-07-15 4:09 ` yu kuai
2026-07-30 8:59 ` yu kuai [this message]
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=079ff51d-fb2b-4064-b560-33ce2b9ededb@fygo.io \
--to=yukuai@fygo.io \
--cc=chencheng@fnnas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox