Re: [PATCH] md/raid1: create serial pool adding rdev to array with serialize_policy=1

"yu kuai" <[email protected]> Fri, 31 Jul 2026 16:27:48 +0800
Newsgroups org.kernel.vger.linux-raid
Message-ID <[email protected]>
=E5=9C=A8 2026/7/23 19:27, Martin Wilck =E5=86=99=E9=81=93:

> The following bug has been observed with kernel 7.1.3 after adding a new
> rdev to an existing RAID1 array that had enabled serialize_policy:
>
> [ 1754.091836][T19639] Oops: Oops: 0002 [#1] SMP NOPTI
> [ 1754.092679][T19639] CPU: 0 UID: 0 PID: 19639 Comm: ext4lazyinit Not ta=
inted 7.1.3-1-default #1 PREEMPT(full) openSUSE Tumbleweed  b041a6527f6e584=
24f4cd3de0fade8d408b378fd
> [ 1754.095245][T19639] Hardware name: QEMU Standard PC (i440FX + PIIX, 19=
96), BIOS unknown 02/02/2022
> [ 1754.096772][T19639] RIP: 0010:_raw_spin_lock_irqsave+0x27/0x50
> [ 1754.097769][T19639] Code: 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 53 9c 58=
 0f 1f 40 00 48 89 c3 fa 0f 1f 44 00 00 65 ff 05 c0 bc d8 01 31 c0 ba 01 00=
 00 00 <3e> 0f b1 17 75 09 48 89 d8 5b e9 85 8d fc fe 89 c6 e8 c3 08 00 00
> [ 1754.100996][T19639] RSP: 0018:ffffcfbbc0a5bab8 EFLAGS: 00010046
> [ 1754.102037][T19639] RAX: 0000000000000000 RBX: 0000000000000212 RCX: 6=
1c8864680b583eb
> [ 1754.103367][T19639] RDX: 0000000000000001 RSI: 000000000000092a RDI: 0=
000000000004960
> [ 1754.104723][T19639] RBP: ffff8efae2b12700 R08: 00000000ffffffff R09: 0=
000000000000000
> [ 1754.106038][T19639] R10: ffffffffa0605ac0 R11: 0000000000000001 R12: f=
fff8efad4199400
> [ 1754.107343][T19639] R13: 0000000000004950 R14: ffff8efaf9164600 R15: 0=
00000000004043e
> [ 1754.108697][T19639] FS:  0000000000000000(0000) GS:ffff8efbdc754000(00=
00) knlGS:0000000000000000
> [ 1754.110190][T19639] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 1754.111280][T19639] CR2: 0000000000004960 CR3: 000000000d830001 CR4: 0=
000000000770ef0
> [ 1754.112580][T19639] PKRU: 55555554
> [ 1754.113182][T19639] Call Trace:
> [ 1754.113754][T19639]  <TASK>
> [ 1754.114256][T19639]  wait_for_serialization+0xb9/0x260 [raid1 9ad4618e=
4becc97c5a7140f7aa35cc4730d97dd9]
> [ 1754.115869][T19639]  raid1_make_request+0x762/0xaff [raid1 9ad4618e4be=
cc97c5a7140f7aa35cc4730d97dd9]
> [ 1754.118368][T19639]  md_handle_request+0x1c9/0x2e0 [md_mod a261f96e3d6=
1eb9d00ceb34dc9439cf6487db185]
>
> The raid1.c code calls wait_for_serialization() if the MD_SERIALIZE_POLIC=
Y
> is set, and wait_for_serialization assumes that rdev->serial is
> initialized. Normally this will be the case for arrays that have
> the serialize_policy sysfs attribute set to 1.
>
> But when a new rdev is added to an existing array in bind_rdev_to_array()=
,
> the condition at mddev_create_serial_pool() causes creation of rdev->seri=
al
> to be skipped. Fix it.
>
> Fixes: 69b00b5bb235 ("md: introduce a new struct for IO serialization")
> Signed-off-by: Martin Wilck<[email protected]>
> ---
>   drivers/md/md.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Update the commit message to only save necessary info for kernel log.

Applied to md-7.3

--=20
Thanks,
Kuai