Skip to content

Commit 31e10a4

Browse files
mauelshasnitm
authored andcommitted
dm raid: fix restoring of failed devices regression
'lvchange --refresh RaidLV' causes a mapped device suspend/resume cycle aiming at device restore and resync after transient device failures. This failed because flag RT_FLAG_RS_RESUMED was always cleared in the suspend path, thus the device restore wasn't performed in the resume path. Solve by removing RT_FLAG_RS_RESUMED from the suspend path and resume unconditionally. Also, remove superfluous comment from raid_resume(). Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent a442328 commit 31e10a4

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

drivers/md/dm-raid.c

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3382,11 +3382,10 @@ static void raid_postsuspend(struct dm_target *ti)
33823382
{
33833383
struct raid_set *rs = ti->private;
33843384

3385-
if (test_and_clear_bit(RT_FLAG_RS_RESUMED, &rs->runtime_flags)) {
3386-
if (!rs->md.suspended)
3387-
mddev_suspend(&rs->md);
3388-
rs->md.ro = 1;
3389-
}
3385+
if (!rs->md.suspended)
3386+
mddev_suspend(&rs->md);
3387+
3388+
rs->md.ro = 1;
33903389
}
33913390

33923391
static void attempt_restore_of_faulty_devices(struct raid_set *rs)
@@ -3606,25 +3605,15 @@ static void raid_resume(struct dm_target *ti)
36063605
* devices are reachable again.
36073606
*/
36083607
attempt_restore_of_faulty_devices(rs);
3609-
} else {
3610-
mddev->ro = 0;
3611-
mddev->in_sync = 0;
3608+
}
36123609

3613-
/*
3614-
* When passing in flags to the ctr, we expect userspace
3615-
* to reset them because they made it to the superblocks
3616-
* and reload the mapping anyway.
3617-
*
3618-
* -> only unfreeze recovery in case of a table reload or
3619-
* we'll have a bogus recovery/reshape position
3620-
* retrieved from the superblock by the ctr because
3621-
* the ongoing recovery/reshape will change it after read.
3622-
*/
3623-
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
3610+
mddev->ro = 0;
3611+
mddev->in_sync = 0;
36243612

3625-
if (mddev->suspended)
3626-
mddev_resume(mddev);
3627-
}
3613+
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
3614+
3615+
if (mddev->suspended)
3616+
mddev_resume(mddev);
36283617
}
36293618

36303619
static struct target_type raid_target = {

0 commit comments

Comments
 (0)