mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user