Re: [PATCH] md/raid1: create serial pool adding rdev to array with serialize_policy=1
Mykola Marzhan <[email protected]> Sun, 26 Jul 2026 14:13:52 +0200
| Newsgroups | org.kernel.vger.linux-raid |
|---|---|
| Message-ID | <[email protected]> |
This reply was drafted with AI assistance. > 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->serial > to be skipped. Fix it. I ran into the same early return from the other direction, so I can confirm the analysis: the new rdev fails rdev_need_serial() (it is not a write-mostly member with write-behind configured), CollisionCheck was never set on it, and mddev_create_serial_pool() returns without allocating rdev->serial. The first write routed to it then crashes in wait_for_serialization(), which is gated on the array-wide flag and assumes the tree exists. serialize_policy is array-wide, so creating the pool for every rdev bound while it is set is the right fix. Reviewed-by: Mykola Marzhan <[email protected]> One interaction to flag. Patch 3 of my P2PDMA series changes that raid1 gate from MD_SERIALIZE_POLICY to per-rdev CollisionCheck, so that writes which skip write-behind also order against in-flight behind I/O on write-mostly members (the behind path already checks CollisionCheck; the non-behind path does not): https://lore.kernel.org/linux-raid/[email protected]/ For the rdev in your report the two gates disagree: without your fix it has no serial tree, and the CollisionCheck gate would skip serialization instead of crashing, hiding the oops but not the bug. So your patch is needed either way and should go in first; with it, every rdev in a serialize_policy array owns a serial tree, and the CollisionCheck gate covers everything the old one did. Patch 3 carries a Link: to your fix. If you see a hole in that reasoning I would rather hear it now than after either patch lands. Mykola