dm raid: fix deadlock caused by premature md_stop_writes()
md_stop_writes() is called in raid_presuspend() causing deadlocks on bios submitted afterwards -- which happens on loaded raid sets with conversion requests. Fix by moving md_stop_writes() to raid_postsuspend(). NOTE: when the recovery's frozen (MD_RECOVERY_FROZEN), writes haven't been started (or are already stopped) so don't stop them again. Also remove superfluous readonly setting. Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
fbc7c07ec2
commit
1af2048a3e
|
@ -3613,24 +3613,19 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
|
||||||
blk_limits_io_opt(limits, chunk_size * mddev_data_stripes(rs));
|
blk_limits_io_opt(limits, chunk_size * mddev_data_stripes(rs));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void raid_presuspend(struct dm_target *ti)
|
|
||||||
{
|
|
||||||
struct raid_set *rs = ti->private;
|
|
||||||
|
|
||||||
md_stop_writes(&rs->md);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
|
if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags)) {
|
||||||
|
/* Writes have to be stopped before suspending to avoid deadlocks. */
|
||||||
|
if (!test_bit(MD_RECOVERY_FROZEN, &rs->md.recovery))
|
||||||
|
md_stop_writes(&rs->md);
|
||||||
|
|
||||||
mddev_lock_nointr(&rs->md);
|
mddev_lock_nointr(&rs->md);
|
||||||
mddev_suspend(&rs->md);
|
mddev_suspend(&rs->md);
|
||||||
mddev_unlock(&rs->md);
|
mddev_unlock(&rs->md);
|
||||||
}
|
}
|
||||||
|
|
||||||
rs->md.ro = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void attempt_restore_of_faulty_devices(struct raid_set *rs)
|
static void attempt_restore_of_faulty_devices(struct raid_set *rs)
|
||||||
|
@ -3903,7 +3898,6 @@ 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,
|
||||||
|
|
Loading…
Reference in New Issue