master - dmsetup: use stderr for error output
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3b7834af17ba17f4c47...
Commit: 3b7834af17ba17f4c478937ac5cb022045bb782b
Parent: 29b2cfba06ee849774025c50599edb1c7587b7d9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 9 23:29:09 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 13 12:58:57 2018 +0100
dmsetup: use stderr for error output
When dmsetup command returns error, the message goes to stderr.
---
tools/dmsetup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index cc47d11..a394c3f 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2191,7 +2191,7 @@ static int _error_device(CMD_ARGS)
name = names ? names->name : argv[0];
if (!name || !*name) {
- printf("No device specified\n");
+ err("No device specified.");
return_0;
}
6 years, 1 month
master - mirror: correct locking for mirror log initialization
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=29b2cfba06ee8497740...
Commit: 29b2cfba06ee849774025c50599edb1c7587b7d9
Parent: 1bd57b4c1d4a6d715d24ab5dc162c350b97fc613
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 13 12:48:36 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 13 12:58:27 2018 +0100
mirror: correct locking for mirror log initialization
The code was not acking proper lock holding LVs when trying to
initialize mirror log to predefined values.
---
WHATS_NEW | 1 +
lib/metadata/mirror.c | 103 +++++++++++++++++--------------------------------
2 files changed, 37 insertions(+), 67 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1d9e61c..faf43fe 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Enhance mirror log initialization for old mirror target.
Skip private crypto and stratis devices.
Skip frozen raid devices from scanning.
Activate RAID SubLVs on read_only_volume_list readwrite
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 6419b5c..d3ced60 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -317,8 +317,13 @@ static int _init_mirror_log(struct cmd_context *cmd,
struct dm_list *tagsl, int remove_on_failure)
{
struct dm_str_list *sl;
- uint64_t orig_status = log_lv->status;
- int was_active = 0;
+
+ if (log_lv != lv_lock_holder(log_lv) || !lv_is_visible(log_lv)) {
+ /* Expect fully visible device for init */
+ log_error(INTERNAL_ERROR "Log LV %s is not top level LV for initialization.",
+ display_lvname(log_lv));
+ return 0;
+ }
if (test_mode()) {
log_verbose("Test mode: Skipping mirror log initialisation.");
@@ -331,53 +336,22 @@ static int _init_mirror_log(struct cmd_context *cmd,
return 0;
}
- /* If the LV is active, deactivate it first. */
- if (lv_is_active(log_lv)) {
- (void) deactivate_lv(cmd, log_lv);
- /*
- * FIXME: workaround to fail early
- * Ensure that log is really deactivated because deactivate_lv
- * on cluster do not fail if there is log_lv with different UUID.
- */
- if (lv_is_active(log_lv)) {
- log_error("Aborting. Unable to deactivate mirror log.");
- goto revert_new_lv;
- }
- was_active = 1;
- }
-
- /* Temporary make it visible for set_lv() */
- lv_set_visible(log_lv);
-
/* Temporary tag mirror log for activation */
dm_list_iterate_items(sl, tagsl)
if (!str_list_add(cmd->mem, &log_lv->tags, sl->str)) {
log_error("Aborting. Unable to tag mirror log.");
- goto activate_lv;
+ return 0;
}
/* store mirror log on disk(s) */
if (!vg_write(log_lv->vg) || !vg_commit(log_lv->vg))
- goto activate_lv;
-
- backup(log_lv->vg);
-
- /* Wait for events following any deactivation before reactivating */
- if (!sync_local_dev_names(cmd)) {
- log_error("Aborting. Failed to sync local devices before initialising mirror log %s.",
- display_lvname(log_lv));
- goto revert_new_lv;
- }
+ return_0;
- if (!activate_lv(cmd, log_lv)) {
+ if (!activate_lv_excl_local(cmd, log_lv)) {
log_error("Aborting. Failed to activate mirror log.");
goto revert_new_lv;
}
- /* Remove the temporary tags */
- dm_list_iterate_items(sl, tagsl)
- str_list_del(&log_lv->tags, sl->str);
-
if (activation()) {
if (!wipe_lv(log_lv, (struct wipe_params)
{ .do_zero = 1, .zero_sectors = log_lv->size,
@@ -385,23 +359,29 @@ static int _init_mirror_log(struct cmd_context *cmd,
log_error("Aborting. Failed to wipe mirror log.");
goto deactivate_and_revert_new_lv;
}
- }
- if (activation() && !_write_log_header(cmd, log_lv)) {
- log_error("Aborting. Failed to write mirror log header.");
- goto deactivate_and_revert_new_lv;
+ if (!_write_log_header(cmd, log_lv)) {
+ log_error("Aborting. Failed to write mirror log header.");
+ goto deactivate_and_revert_new_lv;
+ }
}
if (!deactivate_lv(cmd, log_lv)) {
log_error("Aborting. Failed to deactivate mirror log. "
"Manual intervention required.");
- return 0;
+ goto revert_new_lv;
}
- lv_set_hidden(log_lv);
+ /* Wait for events following any deactivation before reactivating */
+ if (!sync_local_dev_names(cmd)) {
+ log_error("Aborting. Failed to sync local devices before initialising mirror log %s.",
+ display_lvname(log_lv));
+ goto revert_new_lv;
+ }
- if (was_active && !activate_lv(cmd, log_lv))
- return_0;
+ /* Remove the temporary tags */
+ dm_list_iterate_items(sl, tagsl)
+ str_list_del(&log_lv->tags, sl->str);
return 1;
@@ -413,8 +393,6 @@ deactivate_and_revert_new_lv:
}
revert_new_lv:
- log_lv->status = orig_status;
-
dm_list_iterate_items(sl, tagsl)
str_list_del(&log_lv->tags, sl->str);
@@ -430,10 +408,6 @@ revert_new_lv:
else
backup(log_lv->vg);
-activate_lv:
- if (was_active && !remove_on_failure && !activate_lv(cmd, log_lv))
- return_0;
-
return 0;
}
@@ -657,6 +631,7 @@ static int _split_mirror_images(struct logical_volume *lv,
struct lv_list *lvl;
struct cmd_context *cmd = lv->vg->cmd;
char layer_name[NAME_LEN], format[NAME_LEN];
+ int act;
if (!lv_is_mirrored(lv)) {
log_error("Unable to split non-mirrored LV %s.",
@@ -791,30 +766,22 @@ static int _split_mirror_images(struct logical_volume *lv,
* Suspend and resume the mirror - this includes all
* the sub-LVs and soon-to-be-split sub-LVs
*/
- if (!lv_update_and_reload(mirrored_seg->lv))
+ if (!lv_update_and_reload(lv))
return_0;
- /*
- * Recycle newly split LV so it is properly renamed.
- * Cluster requires the extra deactivate/activate calls.
- */
- if (vg_is_clustered(lv->vg) &&
- (!deactivate_lv(cmd, new_lv) ||
- !_activate_lv_like_model(lv, new_lv))) {
- log_error("Failed to rename newly split LV in the kernel");
- return 0;
- }
- if (!suspend_lv(cmd, new_lv) || !resume_lv(cmd, new_lv)) {
+ act = lv_is_active(lv_lock_holder(lv));
+
+ if (act && !_activate_lv_like_model(lv, new_lv)) {
log_error("Failed to rename newly split LV in the kernel");
return 0;
}
/* Remove original mirror layer if it has been converted to linear */
- if (sub_lv && !_delete_lv(lv, sub_lv, 1))
+ if (sub_lv && !_delete_lv(lv, sub_lv, act))
return_0;
/* Remove the log if it has been converted to linear */
- if (detached_log_lv && !_delete_lv(lv, detached_log_lv, 1))
+ if (detached_log_lv && !_delete_lv(lv, detached_log_lv, act))
return_0;
return 1;
@@ -1051,15 +1018,17 @@ static int _remove_mirror_images(struct logical_volume *lv,
/* Mirror with only 1 area is 'in sync'. */
if (new_area_count == 1 && is_temporary_mirror_layer(lv)) {
- if (first_seg(lv)->log_lv &&
- !_init_mirror_log(lv->vg->cmd, first_seg(lv)->log_lv,
+ detached_log_lv = detach_mirror_log(mirrored_seg);
+ if (!_init_mirror_log(lv->vg->cmd, detached_log_lv,
1, &lv->tags, 0)) {
/* As a result, unnecessary sync may run after
* collapsing. But safe.*/
log_error("Failed to initialize log device %s.",
- display_lvname(first_seg(lv)->log_lv));
+ display_lvname(detached_log_lv));
return 0;
}
+ if (!attach_mirror_log(mirrored_seg, detached_log_lv))
+ return_0;
}
if (removed)
6 years, 1 month
master - scanning: skip more private devices
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1bd57b4c1d4a6d715d2...
Commit: 1bd57b4c1d4a6d715d24ab5dc162c350b97fc613
Parent: e095586d9e280877be336ed312368e657114ce14
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 9 14:49:38 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 13 12:57:33 2018 +0100
scanning: skip more private devices
Just like lvm2 has internal devices like _tdata which is using UUID with
suffix, there is similar private type of device for crypto device where
they are using CRYPT-TEMP uuid prefix.
Also ignore stratis.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a27b307..1d9e61c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Skip private crypto and stratis devices.
Skip frozen raid devices from scanning.
Activate RAID SubLVs on read_only_volume_list readwrite
Offer convenience type raid5_n converting to raid10
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 499bf9a..ae3db80 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -32,6 +32,8 @@
#define MAX_TARGET_PARAMSIZE 50000
#define LVM_UDEV_NOSCAN_FLAG DM_SUBSYSTEM_UDEV_FLAG0
+#define CRYPT_TEMP "CRYPT-TEMP"
+#define STRATIS "stratis-"
typedef enum {
PRELOAD,
@@ -637,6 +639,17 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
}
}
+ if (check.check_reserved && uuid &&
+ (!strncmp(uuid, CRYPT_TEMP, sizeof(CRYPT_TEMP) - 1) ||
+ !strncmp(uuid, STRATIS, sizeof(STRATIS) - 1))) {
+ /* Skip private crypto devices */
+ log_debug_activation("%s: Reserved uuid %s on %s device %s not usable.",
+ dev_name(dev), uuid,
+ uuid[0] == 'C' ? "crypto" : "stratis",
+ name);
+ goto out;
+ }
+
/* FIXME Also check for mpath no paths */
do {
next = dm_get_next_target(dmt, next, &start, &length,
6 years, 1 month
master - cleanup: use path on stack
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e095586d9e280877be3...
Commit: e095586d9e280877be336ed312368e657114ce14
Parent: 0edd89fadc3725080136e3d5a638d7df4abe9b95
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 9 12:59:13 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 13 12:57:08 2018 +0100
cleanup: use path on stack
---
lib/metadata/mirror.c | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 4a0e99f..6419b5c 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -270,7 +270,7 @@ int shift_mirror_images(struct lv_segment *mirrored_seg, unsigned mimage)
static int _write_log_header(struct cmd_context *cmd, struct logical_volume *lv)
{
struct device *dev;
- char *name;
+ char name[PATH_MAX];
struct { /* The mirror log header */
uint32_t magic;
uint32_t version;
@@ -281,20 +281,14 @@ static int _write_log_header(struct cmd_context *cmd, struct logical_volume *lv)
log_header.version = xlate32(MIRROR_DISK_VERSION);
log_header.nr_regions = xlate64((uint64_t)-1);
- if (!(name = dm_pool_alloc(cmd->mem, PATH_MAX))) {
- log_error("Name allocation failed - log header not written (%s).",
+ if (dm_snprintf(name, sizeof(name), "%s%s/%s", cmd->dev_dir,
+ lv->vg->name, lv->name) < 0) {
+ log_error("Device path name too long - log header not written (%s).",
display_lvname(lv));
return 0;
}
- if (dm_snprintf(name, PATH_MAX, "%s%s/%s", cmd->dev_dir,
- lv->vg->name, lv->name) < 0) {
- log_error("Name too long - log header not written (%s).",
- display_lvname(lv));
- return 0;
- }
-
- log_verbose("Writing log header to device %s.", display_lvname(lv));
+ log_verbose("Writing log header for LV %s to device %s.", display_lvname(lv), name);
if (!(dev = dev_cache_get(name, NULL))) {
log_error("%s: not found: log header not written.", name);
6 years, 1 month
master - raid: skip frozen raid devices
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0edd89fadc372508013...
Commit: 0edd89fadc3725080136e3d5a638d7df4abe9b95
Parent: a8a579b154432ea3438a8844a724c5a9f3d2548a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 8 13:18:39 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 13 12:57:01 2018 +0100
raid: skip frozen raid devices
Some kernel version suffer from bad state transition where a device
steps into 'frozen' mode. Any application that tries to read such
raid gets unfortunatelly bloked.
As some sort of protection try to skip such raid device from being
scanned to minimize chances to block lvm2 command on such scan.
When such device is found, warning gets printed.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 33 +++++++++++++++++++++++++++++++--
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 177a2fe..a27b307 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Skip frozen raid devices from scanning.
Activate RAID SubLVs on read_only_volume_list readwrite
Offer convenience type raid5_n converting to raid10
Automatically avoid reading invalid snapshots during device scan.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index e0d1fa1..499bf9a 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -531,15 +531,38 @@ static int _ignore_invalid_snapshot(const char *params)
{
struct dm_status_snapshot *s;
struct dm_pool *mem;
- int r;
+ int r = 0;
if (!(mem = dm_pool_create("invalid snapshots", 128)))
return_0;
if (!dm_get_status_snapshot(mem, params, &s))
+ stack;
+ else
+ r = s->invalid;
+
+ dm_pool_destroy(mem);
+
+ return r;
+}
+
+static int _ignore_frozen_raid(struct device *dev, const char *params)
+{
+ struct dm_status_raid *s;
+ struct dm_pool *mem;
+ int r = 0;
+
+ if (!(mem = dm_pool_create("frozen raid", 128)))
return_0;
- r = s->invalid;
+ if (!dm_get_status_raid(mem, params, &s))
+ stack;
+ else if (s->sync_action && !strcmp(s->sync_action, "frozen")) {
+ log_warn("WARNING: %s frozen raid device (%d:%d) needs inspection.",
+ dev_name(dev), (int)MAJOR(dev->dev), (int)MINOR(dev->dev));
+ r = 1;
+ }
+
dm_pool_destroy(mem);
return r;
@@ -669,6 +692,12 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
goto out;
}
+ if (!strncmp(target_type, TARGET_NAME_RAID, 4) && _ignore_frozen_raid(dev, params)) {
+ log_debug_activation("%s: Frozen %s device %s not usable.",
+ dev_name(dev), target_type, name);
+ goto out;
+ }
+
/* TODO: extend check struct ? */
if (!strcmp(target_type, TARGET_NAME_THIN) &&
!_ignore_unusable_thins(dev)) {
6 years, 1 month
master - cleanup: all tests needs target_type
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a8a579b154432ea3438...
Commit: a8a579b154432ea3438a8844a724c5a9f3d2548a
Parent: 0646fd465eef51f3cfbd2219a0992af27d61ae14
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 8 13:01:12 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Mar 13 12:53:59 2018 +0100
cleanup: all tests needs target_type
Simplify code.
---
lib/activate/dev_manager.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index f4d602f..e0d1fa1 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -448,7 +448,11 @@ static int _ignore_suspended_snapshot_component(struct device *dev)
do {
next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
- if (!target_type || !strcmp(target_type, TARGET_NAME_SNAPSHOT)) {
+
+ if (!target_type)
+ continue;
+
+ if (!strcmp(target_type, TARGET_NAME_SNAPSHOT)) {
if (!params || sscanf(params, "%d:%d %d:%d", &major1, &minor1, &major2, &minor2) != 4) {
log_warn("WARNING: Incorrect snapshot table found for %d:%d.",
(int)MAJOR(dev->dev), (int)MINOR(dev->dev));
@@ -615,7 +619,10 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
next = dm_get_next_target(dmt, next, &start, &length,
&target_type, ¶ms);
- if (check.check_blocked && target_type && !strcmp(target_type, TARGET_NAME_MIRROR)) {
+ if (!target_type)
+ continue;
+
+ if (check.check_blocked && !strcmp(target_type, TARGET_NAME_MIRROR)) {
if (ignore_lvm_mirrors()) {
log_debug_activation("%s: Scanning mirror devices is disabled.", dev_name(dev));
goto out;
@@ -649,27 +656,27 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
* correctly, not just snapshots but any cobimnation possible
* in a stack - use proper dm tree to check this instead.
*/
- if (check.check_suspended && target_type &&
+ if (check.check_suspended &&
(!strcmp(target_type, TARGET_NAME_SNAPSHOT) || !strcmp(target_type, TARGET_NAME_SNAPSHOT_ORIGIN)) &&
_ignore_suspended_snapshot_component(dev)) {
log_debug_activation("%s: %s device %s not usable.", dev_name(dev), target_type, name);
goto out;
}
- if (target_type && !strcmp(target_type, TARGET_NAME_SNAPSHOT) &&
+ if (!strcmp(target_type, TARGET_NAME_SNAPSHOT) &&
_ignore_invalid_snapshot(params)) {
log_debug_activation("%s: Invalid %s device %s not usable.", dev_name(dev), target_type, name);
goto out;
}
/* TODO: extend check struct ? */
- if (target_type && !strcmp(target_type, TARGET_NAME_THIN) &&
+ if (!strcmp(target_type, TARGET_NAME_THIN) &&
!_ignore_unusable_thins(dev)) {
log_debug_activation("%s: %s device %s not usable.", dev_name(dev), target_type, name);
goto out;
}
- if (target_type && strcmp(target_type, TARGET_NAME_ERROR))
+ if (strcmp(target_type, TARGET_NAME_ERROR))
only_error_target = 0;
} while (next);
6 years, 1 month
master - dev_manager: always activate RAID SubLVs readwrite
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0646fd465eef51f3cfb...
Commit: 0646fd465eef51f3cfbd2219a0992af27d61ae14
Parent: dd88a0f05cb27d54aa74960bbe9370fa37197cdc
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Mar 12 22:21:13 2018 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Mar 12 22:29:54 2018 +0100
dev_manager: always activate RAID SubLVs readwrite
RaidLVs on read_only_volume_list have their SubLVs
activated readonly thus disabling metadata updates
or image resynchronization/recovery. Bug also causes
automatic repairs to fail.
Fix by always activating the RAID SubLVs readwrite.
Resolves: rhbz1208269
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 40f81f5..177a2fe 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Activate RAID SubLVs on read_only_volume_list readwrite
Offer convenience type raid5_n converting to raid10
Automatically avoid reading invalid snapshots during device scan.
Ensure COW device is writable even for read-only thick snapshots.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 6b042fb..f4d602f 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -80,6 +80,9 @@ int read_only_lv(const struct logical_volume *lv, const struct lv_activate_opts
if (layer && lv_is_cow(lv))
return 0; /* Keep snapshot's COW volume writable */
+ if (lv_is_raid_image(lv) || lv_is_raid_metadata(lv))
+ return 0; /* Keep RAID SubLvs writable */
+
return (laopts->read_only || !(lv->status & LVM_WRITE));
}
6 years, 1 month
master - raid: support raid5_n convenience type on conversion to raid10
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dd88a0f05cb27d54aa7...
Commit: dd88a0f05cb27d54aa74960bbe9370fa37197cdc
Parent: 6cb2c35d1654558efc1b37ca44d77f83682446c7
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 9 21:15:41 2018 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 9 21:23:16 2018 +0100
raid: support raid5_n convenience type on conversion to raid10
Fix requesting a conversion on raid5_{ls,rs,la,ra} -> raid10
not offering offering interim convenience type raid5_n.
Resolves: rhbz1468600
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 2 +-
test/shell/lvconvert-raid5_to_raid10.sh | 63 +++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 16ad1d9..40f81f5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Offer convenience type raid5_n converting to raid10
Automatically avoid reading invalid snapshots during device scan.
Ensure COW device is writable even for read-only thick snapshots.
Support activation of component LVs in read-only mode.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0f56120..7d82a24 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6119,7 +6119,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
return 0;
}
- seg_flag = SEG_RAID0_META;
+ seg_flag = seg_is_raid5_n(seg_from) ? SEG_RAID0_META : SEG_RAID5_N;
} else if (segtype_is_any_raid6(*segtype)) {
if (seg_from->area_count < 4) {
diff --git a/test/shell/lvconvert-raid5_to_raid10.sh b/test/shell/lvconvert-raid5_to_raid10.sh
new file mode 100644
index 0000000..cc0e468
--- /dev/null
+++ b/test/shell/lvconvert-raid5_to_raid10.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 2 || skip
+
+aux prepare_vg 6
+
+#
+# Test multi step raid5 -> raid10 conversion
+#
+
+# Create raid5(_ls) LV
+lvcreate -y --type raid5 -i 3 -L 16M -R 256K -n $lv1 $vg
+check lv_field $vg/$lv1 segtype "raid5"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (first step raid5 -> raid5_n)
+lvconvert -y --ty raid10 $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid5_n"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (second step raid5_n -> raid0_meta)
+lvconvert -y --ty raid10 $vg/$lv1
+check lv_field $vg/$lv1 segtype "raid0_meta"
+check lv_field $vg/$lv1 stripes 3
+check lv_field $vg/$lv1 data_stripes 3
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (third + last step raid0_meta -> raid10)
+lvconvert -y --ty raid10 -R 256K $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid10"
+check lv_field $vg/$lv1 stripes 6
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+
+vgremove -ff $vg
6 years, 1 month
master - raid: support raid5_n convenience type on conversion to raid10
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=efac928c52418dc0650...
Commit: efac928c52418dc06501359f6abb3502a46d8b49
Parent: 6cb2c35d1654558efc1b37ca44d77f83682446c7
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 9 21:15:41 2018 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 9 21:19:08 2018 +0100
raid: support raid5_n convenience type on conversion to raid10
Fix requesting a conversion on raid5_{ls,rs,la,ra} -> raid10
not offering offering interim convenience type raid5_n.
Resolves: rhbz1468600
---
lib/metadata/raid_manip.c | 2 +-
test/shell/lvconvert-raid5_to_raid10.sh | 63 +++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0f56120..7d82a24 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6119,7 +6119,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
return 0;
}
- seg_flag = SEG_RAID0_META;
+ seg_flag = seg_is_raid5_n(seg_from) ? SEG_RAID0_META : SEG_RAID5_N;
} else if (segtype_is_any_raid6(*segtype)) {
if (seg_from->area_count < 4) {
diff --git a/test/shell/lvconvert-raid5_to_raid10.sh b/test/shell/lvconvert-raid5_to_raid10.sh
new file mode 100644
index 0000000..cc0e468
--- /dev/null
+++ b/test/shell/lvconvert-raid5_to_raid10.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 2 || skip
+
+aux prepare_vg 6
+
+#
+# Test multi step raid5 -> raid10 conversion
+#
+
+# Create raid5(_ls) LV
+lvcreate -y --type raid5 -i 3 -L 16M -R 256K -n $lv1 $vg
+check lv_field $vg/$lv1 segtype "raid5"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (first step raid5 -> raid5_n)
+lvconvert -y --ty raid10 $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid5_n"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (second step raid5_n -> raid0_meta)
+lvconvert -y --ty raid10 $vg/$lv1
+check lv_field $vg/$lv1 segtype "raid0_meta"
+check lv_field $vg/$lv1 stripes 3
+check lv_field $vg/$lv1 data_stripes 3
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (third + last step raid0_meta -> raid10)
+lvconvert -y --ty raid10 -R 256K $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid10"
+check lv_field $vg/$lv1 stripes 6
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+
+vgremove -ff $vg
6 years, 1 month
master - raid: support raid5_n convenience type on conversion to raid10
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=321b761d3641e38bec1...
Commit: 321b761d3641e38bec125af789e11466aa9407ae
Parent: 6cb2c35d1654558efc1b37ca44d77f83682446c7
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Mar 9 21:15:41 2018 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Mar 9 21:15:54 2018 +0100
raid: support raid5_n convenience type on conversion to raid10
Fix requesting a conversion on raid5_{ls,rs,la,ra} -> raid10
not offering offering interim convenience type raid5_n.
---
lib/metadata/raid_manip.c | 2 +-
test/shell/lvconvert-raid5_to_raid10.sh | 63 +++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0f56120..7d82a24 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6119,7 +6119,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
return 0;
}
- seg_flag = SEG_RAID0_META;
+ seg_flag = seg_is_raid5_n(seg_from) ? SEG_RAID0_META : SEG_RAID5_N;
} else if (segtype_is_any_raid6(*segtype)) {
if (seg_from->area_count < 4) {
diff --git a/test/shell/lvconvert-raid5_to_raid10.sh b/test/shell/lvconvert-raid5_to_raid10.sh
new file mode 100644
index 0000000..cc0e468
--- /dev/null
+++ b/test/shell/lvconvert-raid5_to_raid10.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 2 || skip
+
+aux prepare_vg 6
+
+#
+# Test multi step raid5 -> raid10 conversion
+#
+
+# Create raid5(_ls) LV
+lvcreate -y --type raid5 -i 3 -L 16M -R 256K -n $lv1 $vg
+check lv_field $vg/$lv1 segtype "raid5"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (first step raid5 -> raid5_n)
+lvconvert -y --ty raid10 $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid5_n"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (second step raid5_n -> raid0_meta)
+lvconvert -y --ty raid10 $vg/$lv1
+check lv_field $vg/$lv1 segtype "raid0_meta"
+check lv_field $vg/$lv1 stripes 3
+check lv_field $vg/$lv1 data_stripes 3
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5 -> raid10 (third + last step raid0_meta -> raid10)
+lvconvert -y --ty raid10 -R 256K $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid10"
+check lv_field $vg/$lv1 stripes 6
+check lv_field $vg/$lv1 data_stripes 3
+check lv_field $vg/$lv1 region_size "256.00k"
+
+vgremove -ff $vg
6 years, 1 month