* [PATCH] md: dont warn about sb update on auto read only arrays
@ 2026-11-06 18:20 incharilla via B4 Relay
2026-11-07 23:50 ` Corey Hickey
2026-11-08 2:53 ` yu kuai
0 siblings, 2 replies; 3+ messages in thread
From: incharilla via B4 Relay @ 2026-11-06 18:20 UTC (permalink / raw)
To: Song Liu, Yu Kuai, Li Nan, Xiao Ni
Cc: Yu Kuai, Corey Hickey, linux-raid, linux-kernel, incharilla
From: incharilla <incharilla@incharilla.site>
Commit 8c9e376b9d1a ("md: warn about updating super block failure") added
an error when md_update_sb is called on a read only array to help debug io
hangs.
An array that is started auto read only prints this error for no reason.
This happens when it is assembled with start_ro set or when a degraded
array is created with start_ro set. md_update_sb already defers the
update by setting MD_SB_CHANGE_DEVS and the sb is written as soon as the
first write makes the array read write. No io can hang on an array that
has not been written to yet.
Skip the message for MD_AUTO_READ the same way dm raid is already skipped.
It is still printed for arrays that are really read only.
Tested in qemu on loop devices with raid1 and raid5 and raid10. Before
this patch assembling a clean array with start_ro set prints the error
for all three levels. Creating a degraded array with start_ro set prints
it in 5 of 10 tries for raid1 and 8 of 10 for raid5 and 4 of 10 for
raid10. After this patch none of these print it. On raid1 the first write
still makes the array read write and the sb events go from 17 to 19.
Assembling with mdadm --readonly still prints the error.
The fix and the qemu test were made with help from Claude Code.
Fixes: 8c9e376b9d1a ("md: warn about updating super block failure")
Reported-by: Corey Hickey <bugfood-c@fatooh.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222162
Signed-off-by: incharilla <incharilla@incharilla.site>
---
Found from bugzilla 222162. The qemu test script used is a busybox
initramfs that creates raid1 and raid5 and raid10 arrays on loop devices
with start_ro set and counts the message in dmesg.
---
drivers/md/md.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 03e35386a80283032e317e037a749eca23ce170e..a0fc6028990530026404f0019a458dfabed02349 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;
---
base-commit: a91337fb5e8e0127c8b5be87be9f3027f95b48bc
change-id: 20261106-md-auto-read-only-sb-warn-7c3d66490643
Best regards,
--
incharilla <incharilla@incharilla.site>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] md: dont warn about sb update on auto read only arrays
2026-11-06 18:20 [PATCH] md: dont warn about sb update on auto read only arrays incharilla via B4 Relay
@ 2026-11-07 23:50 ` Corey Hickey
2026-11-08 2:53 ` yu kuai
1 sibling, 0 replies; 3+ messages in thread
From: Corey Hickey @ 2026-11-07 23:50 UTC (permalink / raw)
To: incharilla, Song Liu, Yu Kuai, Li Nan, Xiao Ni
Cc: Yu Kuai, linux-raid, linux-kernel
On 2026-11-06 10:20, incharilla via B4 Relay wrote:
> Skip the message for MD_AUTO_READ the same way dm raid is already skipped.
> It is still printed for arrays that are really read only.
Thank you. I tested this on Linus's tree and checked messages upon bootup.
With a41e364995bbcfa627418a70fe913c35b7510728 (unpatched):
$ sudo dmesg | grep 'read-only array'
[ 1.589087] md_update_sb: can't update sb for read-only array md2
[ 1.758035] md_update_sb: can't update sb for read-only array md1
[ 1.773313] md_update_sb: can't update sb for read-only array md0
[ 1.885346] md_update_sb: can't update sb for read-only array md3
With your patch on top:
$ sudo dmesg | grep 'read-only array'
(no messages)
I also was no longer able to reproduce the message when creating a
degraded RAID-1 array.
This seems good to me.
Tested-by: Corey Hickey <bugfood-c@fatooh.org>
Thanks,
Corey
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] md: dont warn about sb update on auto read only arrays
2026-11-06 18:20 [PATCH] md: dont warn about sb update on auto read only arrays incharilla via B4 Relay
2026-11-07 23:50 ` Corey Hickey
@ 2026-11-08 2:53 ` yu kuai
1 sibling, 0 replies; 3+ messages in thread
From: yu kuai @ 2026-11-08 2:53 UTC (permalink / raw)
To: incharilla, Song Liu, Li Nan, Xiao Ni, yu kuai
Cc: Yu Kuai, Corey Hickey, linux-raid, linux-kernel
在 2026/11/7 2:20, incharilla via B4 Relay 写道:
> From: incharilla<incharilla@incharilla.site>
>
> Commit 8c9e376b9d1a ("md: warn about updating super block failure") added
> an error when md_update_sb is called on a read only array to help debug io
> hangs.
>
> An array that is started auto read only prints this error for no reason.
> This happens when it is assembled with start_ro set or when a degraded
> array is created with start_ro set. md_update_sb already defers the
> update by setting MD_SB_CHANGE_DEVS and the sb is written as soon as the
> first write makes the array read write. No io can hang on an array that
> has not been written to yet.
>
> Skip the message for MD_AUTO_READ the same way dm raid is already skipped.
> It is still printed for arrays that are really read only.
>
> Tested in qemu on loop devices with raid1 and raid5 and raid10. Before
> this patch assembling a clean array with start_ro set prints the error
> for all three levels. Creating a degraded array with start_ro set prints
> it in 5 of 10 tries for raid1 and 8 of 10 for raid5 and 4 of 10 for
> raid10. After this patch none of these print it. On raid1 the first write
> still makes the array read write and the sb events go from 17 to 19.
> Assembling with mdadm --readonly still prints the error.
>
> The fix and the qemu test were made with help from Claude Code.
>
> Fixes: 8c9e376b9d1a ("md: warn about updating super block failure")
> Reported-by: Corey Hickey<bugfood-c@fatooh.org>
> Closes:https://bugzilla.kernel.org/show_bug.cgi?id=222162
> Signed-off-by: incharilla<incharilla@incharilla.site>
> ---
> Found from bugzilla 222162. The qemu test script used is a busybox
> initramfs that creates raid1 and raid5 and raid10 arrays on loop devices
> with start_ro set and counts the message in dmesg.
> ---
> drivers/md/md.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied
--
Thanks,
Kuai
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-08 2:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 18:20 [PATCH] md: dont warn about sb update on auto read only arrays incharilla via B4 Relay
2026-11-07 23:50 ` Corey Hickey
2026-11-08 2:53 ` yu kuai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®