Linux RAID subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: incharilla <incharilla@incharilla.site>
Cc: linux-raid@vger.kernel.org, yukuai@fygo.io
Subject: Re: [PATCH] md: dont warn about sb update on auto read only arrays
Date: Fri, 06 Nov 2026 18:26:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-202027@kernel.org> (raw)
In-Reply-To: <20261106-md-auto-read-only-sb-warn-v1-1-5bfde3559841@incharilla.site>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] md: badblocks log overlap check fails in
  super_1_allow_new_offset() [1]
--

commit 86c28dfbafd4341535246399e368c7eda6a1eb2d
Author: incharilla <incharilla@incharilla.site>

md: dont warn about sb update on auto read only arrays

This commit suppresses the read-only superblock update error message in
md_update_sb() when the array is in MD_AUTO_READ state.

> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 03e35386a8028..a0fc602899053 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -2819,7 +2819,8 @@ void md_update_sb(struct mddev *mddev, int force_change)
>  	if (!md_is_rdwr(mddev)) {
>  		if (force_change)
>  			set_bit(MD_SB_CHANGE_DEVS, &mddev->sb_flags);
> -		if (!mddev_is_dm(mddev))
> +		/* auto read only arrays write the sb once they become writable */
> +		if (!mddev_is_dm(mddev) && mddev->ro != MD_AUTO_READ)
>  			pr_err_ratelimited("%s: can't update sb for read-only array %s\n",
>  					   __func__, mdname(mddev));
>  		return;

[Severity: Critical]
This problem wasn't introduced by this patch, but does clearing
rdev->badblocks.size in md_update_sb() [1] cause
super_1_allow_new_offset() to miss badblocks log overlaps during a
reshape?

drivers/md/md.c:md_update_sb() {
	...
			if (rdev->badblocks.size) {
				md_write_metadata(mddev, rdev,
						  rdev->badblocks.sector,
						  rdev->badblocks.size << 9,
						  rdev->bb_page, 0);
				rdev->badblocks.size = 0;
			}
	...
}

drivers/md/md.c:super_1_allow_new_offset() {
	...
	if (rdev->badblocks.sector + rdev->badblocks.size > new_offset)
		return 0;

	return 1;
}

super_1_sync() sets rdev->badblocks.size, and md_update_sb() zeroes it as
soon as the badblocks metadata is written.  When a later reshape checks a
new data offset via super_1_allow_new_offset(), rdev->badblocks.size is 0,
allowing new_offset to overlap the on-disk badblocks log and corrupt
metadata or user data.

[1] https://sashiko.dev/#/bug/linux-18a3f5e9-47e5-4da7-8d4b-120745e50fdb

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-md-auto-read-only-sb-warn-v1-1-5bfde3559841@incharilla.site?part=1

  reply	other threads:[~2026-11-06 18:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 18:20 [PATCH] md: dont warn about sb update on auto read only arrays incharilla via B4 Relay
2026-11-06 18:26 ` sashiko-bot [this message]
2026-11-07 23:50 ` Corey Hickey
2026-11-08  2:53 ` 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=sashiko-outbox-202027@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=incharilla@incharilla.site \
    --cc=linux-raid@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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