mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
dm-raid: add a new helper prepare_suspend() in md_personality
[ Upstream commit 5625ff8b72 ]
There are no functional changes for now, prepare to fix a deadlock for
dm-raid456.
Cc: stable@vger.kernel.org # v6.7+
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Xiao Ni <xni@redhat.com>
Acked-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240305072306.2562024-8-yukuai1@huaweicloud.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
347dcdc15a
commit
66a7ae8a5b
@@ -3803,6 +3803,23 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
|
|||||||
blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
|
blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void raid_presuspend(struct dm_target *ti)
|
||||||
|
{
|
||||||
|
struct raid_set *rs = ti->private;
|
||||||
|
struct mddev *mddev = &rs->md;
|
||||||
|
|
||||||
|
if (!reshape_interrupted(mddev))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For raid456, if reshape is interrupted, IO across reshape position
|
||||||
|
* will never make progress, while caller will wait for IO to be done.
|
||||||
|
* Inform raid456 to handle those IO to prevent deadlock.
|
||||||
|
*/
|
||||||
|
if (mddev->pers && mddev->pers->prepare_suspend)
|
||||||
|
mddev->pers->prepare_suspend(mddev);
|
||||||
|
}
|
||||||
|
|
||||||
static void raid_postsuspend(struct dm_target *ti)
|
static void raid_postsuspend(struct dm_target *ti)
|
||||||
{
|
{
|
||||||
struct raid_set *rs = ti->private;
|
struct raid_set *rs = ti->private;
|
||||||
@@ -4087,6 +4104,7 @@ static struct target_type raid_target = {
|
|||||||
.message = raid_message,
|
.message = raid_message,
|
||||||
.iterate_devices = raid_iterate_devices,
|
.iterate_devices = raid_iterate_devices,
|
||||||
.io_hints = raid_io_hints,
|
.io_hints = raid_io_hints,
|
||||||
|
.presuspend = raid_presuspend,
|
||||||
.postsuspend = raid_postsuspend,
|
.postsuspend = raid_postsuspend,
|
||||||
.preresume = raid_preresume,
|
.preresume = raid_preresume,
|
||||||
.resume = raid_resume,
|
.resume = raid_resume,
|
||||||
|
|||||||
@@ -649,6 +649,7 @@ struct md_personality
|
|||||||
int (*start_reshape) (struct mddev *mddev);
|
int (*start_reshape) (struct mddev *mddev);
|
||||||
void (*finish_reshape) (struct mddev *mddev);
|
void (*finish_reshape) (struct mddev *mddev);
|
||||||
void (*update_reshape_pos) (struct mddev *mddev);
|
void (*update_reshape_pos) (struct mddev *mddev);
|
||||||
|
void (*prepare_suspend) (struct mddev *mddev);
|
||||||
/* quiesce suspends or resumes internal processing.
|
/* quiesce suspends or resumes internal processing.
|
||||||
* 1 - stop new actions and wait for action io to complete
|
* 1 - stop new actions and wait for action io to complete
|
||||||
* 0 - return to normal behaviour
|
* 0 - return to normal behaviour
|
||||||
|
|||||||
Reference in New Issue
Block a user