Skip to content

md/raid1,raid10: fix deadlock and bio accounting in read error path

Abd-Alrhman Masalkhi linux-raid lkml 1 version Applied

Status from this message: Applied to md-7.2

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 12 repliesApplied

Changes in v2 from the cover letter

- Split fixes into separate patches for clarity.
- 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/[email protected]/

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3md/raid1,raid10: fix deadlock in read error recovery pathdrivers/md/md.c drivers/md/md.h+21 -92 replies
2/3md/raid1,raid10: fix error-path detection with md_cloned_bio()drivers/md/raid1.c drivers/md/raid10.c+24 -97 replies
3/3md/raid1,raid10: fix bio accounting for split md cloned biosdrivers/md/raid1.c drivers/md/raid10.c+5 -52 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchXiao NiYu Kuai
1/3R-b R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] md/raid1,raid10: fix deadlock and bio accounting in read error path

Hi,

This series revisits an issue in the read error recovery path for raid1 and raid10 when bios are split and resubmitted.

In v1, the approach was to avoid splitting bios in the raid1 thread to prevent recursion and potential deadlocks. However, this was not ideal and too restrictive.

As suggested by Yu Kuai, this series instead handles the problem in md_handle_request() and allows bio splitting.

Link to Yu Kuai' email: https://lore.kernel.org/linux-raid/[email protected]/T/#m714020a38b60fc5f84b9a24f0c46acbe5d7342d6

This series fixes the above by:
- handling md cloned bios explicitly in md_handle_request()
- using md_cloned_bio() to reliably detect the error path
- fixing bio accounting to avoid double/missing accounting

Changes in v2:
- Split fixes into separate patches for clarity.
- 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/[email protected]/

Abd-Alrhman Masalkhi (3):
md/raid1,raid10: fix deadlock in read error recovery path md/raid1,raid10: fix error-path detection with md_cloned_bio() md/raid1,raid10: fix bio accounting for split md cloned bios

 drivers/md/md.c     | 25 ++++++++++++++++---------
 drivers/md/md.h     |  5 +++++
 drivers/md/raid1.c  | 15 +++++++++++----
 drivers/md/raid10.c | 28 ++++++++++++++++++----------
 4 files changed, 50 insertions(+), 23 deletions(-)
Signature · 1 line
2.43.0