Re: [PATCH v2 1/3] md/raid1,raid10: fix deadlock in read error recovery path
From: Yu Kuai
Date: Wed May 20 2026 - 21:28:51 EST
在 2026/5/1 19:46, Abd-Alrhman Masalkhi 写道:
> raid1d and raid10d may resubmit a split md cloned bio while handling
> a read error. In this case, resubmitting the bio can lead to a deadlock
> if the array is suspended before md_handle_request() acquires an
> active_io reference via percpu_ref_tryget_live().
>
> Since the cloned bio already holds an active_io reference,
> trying to acquire another reference via percpu_ref_tryget_live()
> can lead to a deadlock while the array is suspended.
>
> Fix this by using percpu_ref_get() for md cloned bios.
>
> Fixes: bb2a9acefaf9 ("md/raid1: switch to use md_account_bio() for io accounting")
> Fixes: 820455238366 ("md/raid10: switch to use md_account_bio() for io accounting")
> Signed-off-by: Abd-Alrhman Masalkhi<abd.masalkhi@xxxxxxxxx>
> ---
> Changes in v2:
> - Use md_cloned_bio() consistently to detect cloned bios.
> - Recognize that raid10 has the same issue and fix it in this series
> - Allow splitting bios.
> - Handle md cloned bios explicitly in md_handle_request()
> - Link v1:https://lore.kernel.org/linux-raid/20260427103446.300378-1-abd.masalkhi@xxxxxxxxx/
>
> Please let me know if I should add a Suggested-by tag for Yu Kuai,
> as the solution approach was suggested during review.
>
> Link to Yu Kuai' email:https://lore.kernel.org/linux-raid/m2lde74dtw.fsf@xxxxxxxxx/T/#m714020a38b60fc5f84b9a24f0c46acbe5d7342d6
>
> Thanks
> Abd-alrhman
> ---
> drivers/md/md.c | 25 ++++++++++++++++---------
> drivers/md/md.h | 5 +++++
> 2 files changed, 21 insertions(+), 9 deletions(-)
Reviewed-by: Yu Kuai <yukuai@xxxxxxx>
--
Thansk,
Kuai