Re: [PATCH] md: dont warn about sb update on auto read only arrays
From: yu kuai
Date: Sat Nov 07 2026 - 21:54:28 EST
在 2026/11/7 2:20, incharilla via B4 Relay 写道:
> From: incharilla<incharilla@xxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> Closes:https://bugzilla.kernel.org/show_bug.cgi?id=222162
> Signed-off-by: incharilla<incharilla@xxxxxxxxxxxxxxx>
> ---
> 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