summaryrefslogtreecommitdiff
path: root/lib/raid
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2016-10-27 11:38:16 +0200
committerHeinz Mauelshagen <heinzm@redhat.com>2016-10-27 11:42:07 +0200
commitff05ed7afd16048b64ee3bd94476b1d19e5022db (patch)
tree2e9017f910fe39dc07a51d4a7e8007e07e0fcdaa /lib/raid
parente84f527cd37fa713774e30c63509bfeef8271618 (diff)
downloadlvm2-ff05ed7afd16048b64ee3bd94476b1d19e5022db.tar.gz
lvchange/vgchange/lvconvert: prevent raid4 creation/activation/conversion on non-supporting raid targets
Check for dm-raid target version with non-standard raid4 mapping expecting the dedicated parity device in the last rather than the first slot and prohibit to create, activate or convert to such LVs from striped/raid0* or vice-versa in order to avoid data corruption. Add related tests to lvconvert-raid-takeover.sh Resolves: rhbz1388962
Diffstat (limited to 'lib/raid')
-rw-r--r--lib/raid/raid.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 3bc3c757a..92a96a3e9 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2013 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2016 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -366,7 +366,7 @@ static int _raid_target_present(struct cmd_context *cmd,
static int _raid_checked = 0;
static int _raid_present = 0;
- static int _raid_attrs = 0;
+ static unsigned _raid_attrs = 0;
uint32_t maj, min, patchlevel;
unsigned i;
@@ -389,6 +389,12 @@ static int _raid_target_present(struct cmd_context *cmd,
else
log_very_verbose("Target raid does not support %s.",
_features[i].feature);
+
+ if (!(maj == 1 && (min == 8 || (min == 9 && patchlevel == 0))))
+ _raid_attrs |= RAID_FEATURE_RAID4;
+ else
+ log_very_verbose("Target raid does not support %s.",
+ SEG_TYPE_NAME_RAID4);
}
if (attributes)