diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2016-06-24 17:21:37 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-07-18 15:37:28 -0400 |
commit | 37f10be15076737067a4d4d8f1cf7e9103765a0f (patch) | |
tree | f9abfcb4da5c9060e63ec11c43fa45ede567b09b /drivers/md/dm-raid.c | |
parent | b1956dc4fa5c055e2229b848de418f1528ae7990 (diff) |
dm raid: fix rebuild and catch bogus sync/resync flags
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r-- | drivers/md/dm-raid.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 2fb5a9bff1bb..14b3d93e84cb 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -1312,6 +1312,13 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as, | |||
1312 | return -EINVAL; | 1312 | return -EINVAL; |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags) && | ||
1316 | (test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags) || | ||
1317 | test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags))) { | ||
1318 | rs->ti->error = "sync/nosync and rebuild are mutually exclusive"; | ||
1319 | return -EINVAL; | ||
1320 | } | ||
1321 | |||
1315 | if (write_mostly >= rs->md.raid_disks) { | 1322 | if (write_mostly >= rs->md.raid_disks) { |
1316 | rs->ti->error = "Can't set all raid1 devices to write_mostly"; | 1323 | rs->ti->error = "Can't set all raid1 devices to write_mostly"; |
1317 | return -EINVAL; | 1324 | return -EINVAL; |
@@ -2776,7 +2783,9 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2776 | } else if (rs_is_recovering(rs) || rs_is_reshaping(rs)) { | 2783 | } else if (rs_is_recovering(rs) || rs_is_reshaping(rs)) { |
2777 | /* Have to reject size change request during recovery/reshape */ | 2784 | /* Have to reject size change request during recovery/reshape */ |
2778 | if (calculated_dev_sectors != rs->dev[0].rdev.sectors) { | 2785 | if (calculated_dev_sectors != rs->dev[0].rdev.sectors) { |
2779 | ti->error = "Can't resize a recovering/reshaping raid set"; | 2786 | ti->error = rs_is_recovering(rs) ? |
2787 | "Can't resize a recovering raid set" : | ||
2788 | "Can't resize a reshaping raid set"; | ||
2780 | r = -EPERM; | 2789 | r = -EPERM; |
2781 | goto bad; | 2790 | goto bad; |
2782 | } | 2791 | } |
@@ -2863,8 +2872,12 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2863 | rs_setup_recovery(rs, MaxSector); | 2872 | rs_setup_recovery(rs, MaxSector); |
2864 | } else { | 2873 | } else { |
2865 | rs_set_cur(rs); | 2874 | rs_set_cur(rs); |
2866 | rs_setup_recovery(rs, test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags) ? | 2875 | if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags)) { |
2867 | 0 : calculated_dev_sectors); | 2876 | rs_setup_recovery(rs, MaxSector); |
2877 | set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags); | ||
2878 | } else | ||
2879 | rs_setup_recovery(rs, test_bit(__CTR_FLAG_SYNC, &rs->ctr_flags) ? | ||
2880 | 0 : calculated_dev_sectors); | ||
2868 | } | 2881 | } |
2869 | 2882 | ||
2870 | /* If constructor requested it, change data and new_data offsets */ | 2883 | /* If constructor requested it, change data and new_data offsets */ |