Skip to content

Commit 5625ff8

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
dm-raid: add a new helper prepare_suspend() in md_personality
There are no functional changes for now, prepare to fix a deadlock for dm-raid456. Cc: [email protected] # v6.7+ Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Xiao Ni <[email protected]> Acked-by: Mike Snitzer <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cd32b27 commit 5625ff8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

drivers/md/dm-raid.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3803,6 +3803,23 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
38033803
blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
38043804
}
38053805

3806+
static void raid_presuspend(struct dm_target *ti)
3807+
{
3808+
struct raid_set *rs = ti->private;
3809+
struct mddev *mddev = &rs->md;
3810+
3811+
if (!reshape_interrupted(mddev))
3812+
return;
3813+
3814+
/*
3815+
* For raid456, if reshape is interrupted, IO across reshape position
3816+
* will never make progress, while caller will wait for IO to be done.
3817+
* Inform raid456 to handle those IO to prevent deadlock.
3818+
*/
3819+
if (mddev->pers && mddev->pers->prepare_suspend)
3820+
mddev->pers->prepare_suspend(mddev);
3821+
}
3822+
38063823
static void raid_postsuspend(struct dm_target *ti)
38073824
{
38083825
struct raid_set *rs = ti->private;
@@ -4087,6 +4104,7 @@ static struct target_type raid_target = {
40874104
.message = raid_message,
40884105
.iterate_devices = raid_iterate_devices,
40894106
.io_hints = raid_io_hints,
4107+
.presuspend = raid_presuspend,
40904108
.postsuspend = raid_postsuspend,
40914109
.preresume = raid_preresume,
40924110
.resume = raid_resume,

drivers/md/md.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ struct md_personality
659659
int (*start_reshape) (struct mddev *mddev);
660660
void (*finish_reshape) (struct mddev *mddev);
661661
void (*update_reshape_pos) (struct mddev *mddev);
662+
void (*prepare_suspend) (struct mddev *mddev);
662663
/* quiesce suspends or resumes internal processing.
663664
* 1 - stop new actions and wait for action io to complete
664665
* 0 - return to normal behaviour

0 commit comments

Comments
 (0)