[PATCH 08/10] md: switch to using blk_next_discard_bio directly

Christoph Hellwig
2024-03-07T15:12:20Z

This fixes fatal signals getting into the way and corrupting the bio
chain and removes the need to handle synchronous errors.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/md.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7d7b982e369c11..5803a298dd40f9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8722,8 +8722,10 @@ void md_submit_discard_bio(struct mddev *mddev, struct md_rdev *rdev,
{
struct bio *discard_bio = NULL;

- if (__blkdev_issue_discard(rdev->bdev, start, size, GFP_NOIO,
- &discard_bio) || !discard_bio)
+ while (blk_next_discard_bio(rdev->bdev, &discard_bio, &start, &size,
+ GFP_NOIO))
+ ;
+ if (!discard_bio)
return;

bio_chain(discard_bio, bio);
--
2.39.2