From: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
To: Chen Cheng <chencheng@fnnas.com>,
linux-raid@vger.kernel.org, yukuai@fygo.io
Cc: chencheng@fnnas.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] md: protect read mddev->recovery in md_sync_action()
Date: Sat, 27 Jun 2026 12:46:51 +0200 [thread overview]
Message-ID: <m25x341cro.fsf@gmail.com> (raw)
In-Reply-To: <20260627102909.141036-1-chencheng@fnnas.com>
On Sat, Jun 27, 2026 at 18:29 +0800, Chen Cheng wrote:
> From: Chen Cheng <chencheng@fnnas.com>
>
> md_sync_action() read mddev->recovery in lockless path, use READ_ONCE()
> instead of u64 plain read.
>
unisgned long is not always u64...
I can not see what it fixes, is this just to silence KCSAN? If so,
please say so in the commit message.
> Fixes: e792a4c2156a3 ("md: add new helpers for sync_action")
>
> Signed-off-by: Chen Cheng <chencheng@fnnas.com>
> ---
> drivers/md/md.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index c5c50640b684..f4415c1a79d9 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -5074,11 +5074,11 @@ static enum sync_action md_get_active_sync_action(struct mddev *mddev)
> return is_recover ? ACTION_RECOVER : ACTION_IDLE;
> }
>
> enum sync_action md_sync_action(struct mddev *mddev)
> {
> - unsigned long recovery = mddev->recovery;
> + unsigned long recovery = READ_ONCE(mddev->recovery);
> enum sync_action active_action;
>
> /*
> * frozen has the highest priority, means running sync_thread will be
> * stopped immediately, and no new sync_thread can start.
> --
> 2.54.0
>
--
Best Regards,
Abd-Alrhman
next prev parent reply other threads:[~2026-06-27 10:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 10:29 [PATCH] md: protect read mddev->recovery in md_sync_action() Chen Cheng
2026-06-27 10:46 ` Abd-Alrhman Masalkhi [this message]
2026-06-27 10:52 ` Chen Cheng
2026-06-27 11:25 ` Abd-Alrhman Masalkhi
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=m25x341cro.fsf@gmail.com \
--to=abd.masalkhi@gmail.com \
--cc=chencheng@fnnas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=yukuai@fygo.io \
/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