Re: [PATCH] md/raid1: create serial pool adding rdev to array with serialize_policy=1
Martin Wilck <[email protected]> Mon, 27 Jul 2026 10:39:15 +0200
| Newsgroups | org.kernel.vger.linux-raid |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2026-07-26 at 14:13 +0200, Mykola Marzhan wrote: > 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. I fully agree. My patch is just a small bug fix. Your changes go much deeper. Regards, Martin -- Dr. Martin Wilck <[email protected]> SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg, Germany Geschäftsführer: Jochen Jaser, Andrew McDonald (HRB 36809,AG Nürnberg)