summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-raid.c
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2016-06-24 00:32:58 +0200
committerMike Snitzer <snitzer@redhat.com>2016-07-18 21:37:24 +0200
commit2d92a3c2a45c7c40c84a4a59e3ce2bf6b34a4195 (patch)
treec8e3792b5d2929eeb48acdd66d4e1b00a29976bf /drivers/md/dm-raid.c
parentdm raid: clarify and fix recovery (diff)
downloadlinux-2d92a3c2a45c7c40c84a4a59e3ce2bf6b34a4195.tar.xz
linux-2d92a3c2a45c7c40c84a4a59e3ce2bf6b34a4195.zip
dm raid: prohibit 'nosync' on new raid6 and reject resize during reshape
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.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 7e334b65b1c3..6dc494055267 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2752,9 +2752,21 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv)
if (test_bit(MD_ARRAY_FIRST_USE, &rs->md.flags)) {
set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags);
rs_set_new(rs);
- } else if (rs_is_reshaping(rs))
- ; /* skip rs setup */
- else if (rs_takeover_requested(rs)) {
+ /* A new raid6 set has to be recovered to ensure proper parity and Q-Syndrome */
+ if (rs_is_raid6(rs) &&
+ test_bit(__CTR_FLAG_NOSYNC, &rs->ctr_flags)) {
+ ti->error = "'nosync' not allowed for new raid6 set";
+ return -EINVAL;
+ }
+ rs_setup_recovery(rs, 0);
+ } else if (rs_is_reshaping(rs)) {
+ /* Have to reject size change request during reshape */
+ if (calculated_dev_sectors != rs->dev[0].rdev.sectors) {
+ ti->error = "Can't resize a reshaping raid set";
+ return -EPERM;
+ }
+ /* skip setup rs */
+ } else if (rs_takeover_requested(rs)) {
if (rs_is_reshaping(rs)) {
ti->error = "Can't takeover a reshaping raid set";
return -EPERM;