diff options
| author | Genjian Zhang <zhanggenjian@kylinos.cn> | 2026-07-12 00:13:26 +0800 |
|---|---|---|
| committer | Yu Kuai <yukuai@fygo.io> | 2026-07-31 12:34:44 +0800 |
| commit | 85764f475f3b3abd956bf8eaeaa643b367676cf4 (patch) | |
| tree | 53c8b18b5af820ddbfee602adb754ac84700f099 | |
| parent | fe8d6b0187469c91d57dbc25ece5b503bfb3bc26 (diff) | |
md/raid5: complete discard bios while reshape is active
make_discard_request() returns without completing the bio when reshape
is in progress. Discard callers block in submit_bio_wait()
waiting for a completion that never arrives. The caller hangs in
uninterruptible sleep, and this does not resolve when reshape finishes.
Complete the bio with BLK_STS_AGAIN so userspace can retry after reshape,
consistent with the existing policy of not processing discard during
reshape.
Tested on a loop-backed RAID5 array during mdadm --grow: without this
patch, blkdiscard hangs in bio_await() and remains in uninterruptible
sleep after md reports "reshape done"; with this patch it returns
-EAGAIN instead.
Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Link: https://patch.msgid.link/20260711161326.962336-1-zhanggenjian@126.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
| -rw-r--r-- | drivers/md/raid5.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 552624bbec91..e5348cebf12d 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5794,8 +5794,7 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) int stripe_sectors; if (mddev->reshape_position != MaxSector) - /* Skip discard while reshape is happening */ - return; + goto complete_again; if (!raid5_discard_limits(mddev, bi)) return; @@ -5882,6 +5881,11 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) } bio_endio(bi); + return; + +complete_again: + /* Skip discard while reshape is happening */ + bio_endio_status(bi, BLK_STS_AGAIN); } static bool ahead_of_reshape(struct mddev *mddev, sector_t sector, |
