Commit 37f10be1 authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Mike Snitzer

dm raid: fix rebuild and catch bogus sync/resync flags

Signed-off-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent b1956dc4
...@@ -1312,6 +1312,13 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as, ...@@ -1312,6 +1312,13 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as,
return -EINVAL; return -EINVAL;
} }
if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags) &&
(test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags) ||
test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags))) {
rs->ti->error = "sync/nosync and rebuild are mutually exclusive";
return -EINVAL;
}
if (write_mostly >= rs->md.raid_disks) { if (write_mostly >= rs->md.raid_disks) {
rs->ti->error = "Can't set all raid1 devices to write_mostly"; rs->ti->error = "Can't set all raid1 devices to write_mostly";
return -EINVAL; return -EINVAL;
...@@ -2776,7 +2783,9 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) ...@@ -2776,7 +2783,9 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
} else if (rs_is_recovering(rs) || rs_is_reshaping(rs)) { } else if (rs_is_recovering(rs) || rs_is_reshaping(rs)) {
/* Have to reject size change request during recovery/reshape */ /* Have to reject size change request during recovery/reshape */
if (calculated_dev_sectors != rs->dev[0].rdev.sectors) { if (calculated_dev_sectors != rs->dev[0].rdev.sectors) {
ti->error = "Can't resize a recovering/reshaping raid set"; ti->error = rs_is_recovering(rs) ?
"Can't resize a recovering raid set" :
"Can't resize a reshaping raid set";
r = -EPERM; r = -EPERM;
goto bad; goto bad;
} }
...@@ -2863,6 +2872,10 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) ...@@ -2863,6 +2872,10 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
rs_setup_recovery(rs, MaxSector); rs_setup_recovery(rs, MaxSector);
} else { } else {
rs_set_cur(rs); rs_set_cur(rs);
if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags)) {
rs_setup_recovery(rs, MaxSector);
set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags);
} else
rs_setup_recovery(rs, test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags) ? rs_setup_recovery(rs, test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags) ?
0 : calculated_dev_sectors); 0 : calculated_dev_sectors);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment