diff --git a/SOURCES/lvm2-2_02_178-activation-guard-exclusive-activation.patch b/SOURCES/lvm2-2_02_178-activation-guard-exclusive-activation.patch new file mode 100644 index 00000000..4221e16f --- /dev/null +++ b/SOURCES/lvm2-2_02_178-activation-guard-exclusive-activation.patch @@ -0,0 +1,53 @@ +From da05bd7f7207eeab5fbd70b7a7c5166a9885e3b4 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Mon, 15 Jan 2018 16:26:00 +0100 +Subject: [PATCH 18/25] activation: guard exclusive activation + +Add protectional internall error whenever we spot activation +of 'exclusive' only segments in 'non-exclusive' mode. + +TODO: possibly the activation locking could be enhanced to handle +this fully behind the scene - as for now this works purely for +lvchange/vgchange activation. + +(cherry picked from commit a8bcdef4fd172b705572e3c0b277e6941be642f4) +--- + WHATS_NEW | 1 + + lib/activate/activate.c | 10 ++++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 4368543..c3117de 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.178 - + ===================================== ++ Avoid non-exclusive activation of exclusive segment types. + Fix trimming sibling PVs when doing a pvmove of raid subLVs. + Preserve exclusive activation during thin snaphost merge. + Avoid exceeding array bounds in allocation tag processing. +diff --git a/lib/activate/activate.c b/lib/activate/activate.c +index 4c69af7..b23400a 100644 +--- a/lib/activate/activate.c ++++ b/lib/activate/activate.c +@@ -2568,6 +2568,16 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s, + struct lvinfo info; + int r = 0; + ++ if (!laopts->exclusive && ++ (lv_is_origin(lv) || ++ lv_is_pvmove(lv) || ++ seg_only_exclusive(first_seg(lv)))) { ++ log_error(INTERNAL_ERROR "Trying non-exlusive activation of %s with " ++ "a volume type %s requiring exclusive activation.", ++ display_lvname(lv), lvseg_name(first_seg(lv))); ++ return 0; ++ } ++ + if (!activation()) + return 1; + +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-activation-move-check-later.patch b/SOURCES/lvm2-2_02_178-activation-move-check-later.patch new file mode 100644 index 00000000..0b17a2ee --- /dev/null +++ b/SOURCES/lvm2-2_02_178-activation-move-check-later.patch @@ -0,0 +1,45 @@ +From e3e7ea0c384da84ccd38406482ec1877c6b19d8a Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Wed, 17 Jan 2018 15:15:43 +0100 +Subject: [PATCH 25/25] activation: move check later + +Check for lv when it's known in all cases. + +(cherry picked from commit f3c75bb2014e9ae7d212e0c016a94c529ac8a912) +--- + lib/activate/activate.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/lib/activate/activate.c b/lib/activate/activate.c +index b23400a..18cc7cf 100644 +--- a/lib/activate/activate.c ++++ b/lib/activate/activate.c +@@ -2568,6 +2568,12 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s, + struct lvinfo info; + int r = 0; + ++ if (!activation()) ++ return 1; ++ ++ if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0))) ++ goto out; ++ + if (!laopts->exclusive && + (lv_is_origin(lv) || + lv_is_pvmove(lv) || +@@ -2578,12 +2584,6 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s, + return 0; + } + +- if (!activation()) +- return 1; +- +- if (!lv && !(lv_to_free = lv = lv_from_lvid(cmd, lvid_s, 0))) +- goto out; +- + if (filter && !_passes_activation_filter(cmd, lv)) { + log_verbose("Not activating %s since it does not pass " + "activation filter.", display_lvname(lv)); +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-allocation-Avoid-exceeding-array-bounds-in-allocatio.patch b/SOURCES/lvm2-2_02_178-allocation-Avoid-exceeding-array-bounds-in-allocatio.patch new file mode 100644 index 00000000..c5146851 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-allocation-Avoid-exceeding-array-bounds-in-allocatio.patch @@ -0,0 +1,47 @@ +From ce8663ee13e68b8f21dce6e2cf612d3809519787 Mon Sep 17 00:00:00 2001 +From: Alasdair G Kergon +Date: Wed, 10 Jan 2018 02:03:32 +0000 +Subject: [PATCH 12/25] allocation: Avoid exceeding array bounds in allocation + tag code + +If _limit_to_one_area_per_tag() changes nothing it writes beyond +the array. + +(cherry picked from commit bacc94233368cf136b55e2574e969e7f53b31c6c) + +Conflicts: + WHATS_NEW +--- + WHATS_NEW | 4 ++++ + lib/metadata/lv_manip.c | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 2163a5e..9375a86 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,3 +1,7 @@ ++Version 2.02.178 - ++===================================== ++ Avoid exceeding array bounds in allocation tag processing. ++ + Version 2.02.177 - 18th December 2017 + ===================================== + When writing text metadata content, use complete 4096 byte blocks. +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index 70dc2d9..ac30dad 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -2737,7 +2737,8 @@ static int _limit_to_one_area_per_tag(struct alloc_handle *ah, struct alloc_stat + s++; + } + +- alloc_state->areas[u].pva = NULL; ++ if (u < alloc_state->areas_size) ++ alloc_state->areas[u].pva = NULL; + + return 1; + } +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-cleanup-drop-unused-code.patch b/SOURCES/lvm2-2_02_178-cleanup-drop-unused-code.patch new file mode 100644 index 00000000..f738e927 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-cleanup-drop-unused-code.patch @@ -0,0 +1,40 @@ +From be970a7e85cd3659119ca349303f3dd2ef40592b Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 11 Jan 2018 16:11:21 +0100 +Subject: [PATCH 20/25] cleanup: drop unused code + +(cherry picked from commit 3aedaa7f2aa3c8622538e2758bf905ceb156db4a) +--- + tools/pvmove.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index af3fec4..b3d1d89 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -329,8 +329,6 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + uint32_t log_count = 0; + int lv_found = 0; + int lv_skipped = 0; +- int lv_active_count = 0; +- int lv_exclusive_count = 0; + + /* FIXME Cope with non-contiguous => splitting existing segments */ + if (!(lv_mirr = lv_create_empty("pvmove%d", NULL, +@@ -451,13 +449,6 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + continue; + } + +- if (vg_is_clustered(vg)) { +- if (lv_is_active_exclusive_locally(lv)) +- lv_exclusive_count++; +- else if (lv_is_active(lv)) +- lv_active_count++; +- } +- + if (!_insert_pvmove_mirrors(cmd, lv_mirr, source_pvl, lv, + *lvs_changed)) + return_NULL; +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-cleanup-enhance-messages.patch b/SOURCES/lvm2-2_02_178-cleanup-enhance-messages.patch new file mode 100644 index 00000000..fe914e6c --- /dev/null +++ b/SOURCES/lvm2-2_02_178-cleanup-enhance-messages.patch @@ -0,0 +1,90 @@ +From f2365e3e82309056c2921016584a56210da6888b Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 11 Jan 2018 10:46:04 +0100 +Subject: [PATCH 19/25] cleanup: enhance messages + +Add extra info about failing local exlusive activation +(as in cluster the LV can be active on some other nodes). + +(cherry picked from commit 38b81e6537a8dc497a4bc616a1f51632b43137ca) +--- + lib/locking/locking.c | 3 ++- + tools/pvmove.c | 27 ++++++++++++++------------- + 2 files changed, 16 insertions(+), 14 deletions(-) + +diff --git a/lib/locking/locking.c b/lib/locking/locking.c +index c68d4c7..8daa61e 100644 +--- a/lib/locking/locking.c ++++ b/lib/locking/locking.c +@@ -406,7 +406,8 @@ int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs) + + dm_list_iterate_items(lvl, lvs) { + if (!activate_lv_excl_local(cmd, lvl->lv)) { +- log_error("Failed to activate %s", display_lvname(lvl->lv)); ++ log_error("Failed to locally exclusively activate %s.", ++ display_lvname(lvl->lv)); + dm_list_uniterate(lvh, lvs, &lvl->list) { + lvl = dm_list_item(lvh, struct lv_list); + if (!deactivate_lv(cmd, lvl->lv)) +diff --git a/tools/pvmove.c b/tools/pvmove.c +index c5d7e52..af3fec4 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -375,9 +375,9 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + continue; + + if (lv_is_converting(lv) || lv_is_merging(lv)) { +- log_error("Unable to pvmove when %s volumes are present.", +- lv_is_converting(lv) ? +- "converting" : "merging"); ++ log_error("Unable to pvmove when %s volume %s is present.", ++ lv_is_converting(lv) ? "converting" : "merging", ++ display_lvname(lv)); + return NULL; + } + +@@ -389,13 +389,13 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + return_NULL; + + /* +- * Remove any PVs holding SubLV siblings to allow +- * for collocation (e.g. *rmeta_0 -> *rimage_0). +- * +- * Callee checks for lv_name and valid raid segment type. +- * +- * FIXME: don't rely on namespace +- */ ++ * Remove any PVs holding SubLV siblings to allow ++ * for collocation (e.g. *rmeta_0 -> *rimage_0). ++ * ++ * Callee checks for lv_name and valid raid segment type. ++ * ++ * FIXME: don't rely on namespace ++ */ + if (!_remove_sibling_pvs_from_trim_list(lv, lv_name, &trim_list)) + return_NULL; + +@@ -436,7 +436,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + + if (lv_is_locked(lv)) { + lv_skipped = 1; +- log_print_unless_silent("Skipping locked LV %s.", lv->name); ++ log_print_unless_silent("Skipping locked LV %s.", display_lvname(lv)); + continue; + } + +@@ -445,8 +445,9 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + lv_is_active(lv) && + !lv_is_active_exclusive_locally(lv)) { + lv_skipped = 1; +- log_print_unless_silent("Skipping LV %s which is activated " +- "exclusively on remote node.", lv->name); ++ log_print_unless_silent("Skipping LV %s which is active, " ++ "but not locally exclusively.", ++ display_lvname(lv)); + continue; + } + +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-dmeventd-add-check-for-result-code.patch b/SOURCES/lvm2-2_02_178-dmeventd-add-check-for-result-code.patch new file mode 100644 index 00000000..41060a6f --- /dev/null +++ b/SOURCES/lvm2-2_02_178-dmeventd-add-check-for-result-code.patch @@ -0,0 +1,39 @@ +From 94a631461d2d17e1847d2e215bce297bb1a2b70d Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 5 Jan 2018 21:08:24 +0100 +Subject: [PATCH 17/25] dmeventd: add check for result code + +Check result from pthread_kill. + +(cherry picked from commit f41935909fec9eb8d64bc04530be2f38866f0b8e) +--- + daemons/dmeventd/dmeventd.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c +index 7ad7f81..8917422 100644 +--- a/daemons/dmeventd/dmeventd.c ++++ b/daemons/dmeventd/dmeventd.c +@@ -754,6 +754,7 @@ static void *_timeout_thread(void *unused __attribute__((unused))) + struct thread_status *thread; + struct timespec timeout; + time_t curr_time; ++ int ret; + + DEBUGLOG("Timeout thread starting."); + pthread_cleanup_push(_exit_timeout, NULL); +@@ -775,7 +776,10 @@ static void *_timeout_thread(void *unused __attribute__((unused))) + } else { + DEBUGLOG("Sending SIGALRM to Thr %x for timeout.", + (int) thread->thread); +- pthread_kill(thread->thread, SIGALRM); ++ ret = pthread_kill(thread->thread, SIGALRM); ++ if (ret && (ret != ESRCH)) ++ log_error("Unable to wakeup Thr %x for timeout: %s.", ++ (int) thread->thread, strerror(ret)); + } + _unlock_mutex(); + } +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-libdm-accept-mirror-status-with-userspace-word-in-th.patch b/SOURCES/lvm2-2_02_178-libdm-accept-mirror-status-with-userspace-word-in-th.patch new file mode 100644 index 00000000..68016049 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-libdm-accept-mirror-status-with-userspace-word-in-th.patch @@ -0,0 +1,32 @@ + WHATS_NEW_DM | 4 ++++ + libdm/libdm-targets.c | 5 +++++ + 2 files changed, 9 insertions(+) + +diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM +index 8b304e6..fb92416 100644 +--- a/WHATS_NEW_DM ++++ b/WHATS_NEW_DM +@@ -1,3 +1,7 @@ ++Version 1.02.147 - ++===================================== ++ Parsing mirror status accepts 'userspace' keyword in status. ++ + Version 1.02.146 - 18th December 2017 + ===================================== + Activation tree of thin pool skips duplicated check of pool status. +diff --git a/libdm/libdm-targets.c b/libdm/libdm-targets.c +index 990d275..8766789 100644 +--- a/libdm/libdm-targets.c ++++ b/libdm/libdm-targets.c +@@ -508,6 +508,11 @@ int dm_get_status_mirror(struct dm_pool *mem, const char *params, + if (!(pos = _skip_fields(pos, argc))) + goto_out; + ++ if (strncmp(pos, "userspace", 9) == 0) { ++ pos += 9; ++ /* FIXME: support status of userspace mirror implementation */ ++ } ++ + if (sscanf(pos, "%u %n", &argc, &used) != 1) + goto_out; + pos += used; diff --git a/SOURCES/lvm2-2_02_178-locking-exclusive-can-be-either-remote-or-local.patch b/SOURCES/lvm2-2_02_178-locking-exclusive-can-be-either-remote-or-local.patch new file mode 100644 index 00000000..f0e1cc5b --- /dev/null +++ b/SOURCES/lvm2-2_02_178-locking-exclusive-can-be-either-remote-or-local.patch @@ -0,0 +1,32 @@ + WHATS_NEW | 1 + + lib/activate/activate.c | 5 ++++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 762553f..776c739 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.178 - + ===================================== ++ Do not report LV as remotely active when it's locally exclusive in cluster. + Add deprecate messages for usage of mirrors with mirrorlog. + Restore pvmove support for wide-clustered active volumes (2.02.177). + Avoid non-exclusive activation of exclusive segment types. +diff --git a/lib/activate/activate.c b/lib/activate/activate.c +index 7a37130..b67e7b1 100644 +--- a/lib/activate/activate.c ++++ b/lib/activate/activate.c +@@ -1543,8 +1543,11 @@ static int _lv_is_active(const struct logical_volume *lv, + if (skip_cluster_query) + goto out; + +- if ((r = cluster_lock_held(lv->lvid.s, "", &e)) >= 0) ++ if ((r = cluster_lock_held(lv->lvid.s, "", &e)) >= 0) { ++ if (l && e) ++ r = 0; /* exclusive locally */ + goto out; ++ } + + /* + * If lock query is not supported (due to interfacing with old diff --git a/SOURCES/lvm2-2_02_178-lvconvert-use-excl-activation-for-conversion.patch b/SOURCES/lvm2-2_02_178-lvconvert-use-excl-activation-for-conversion.patch new file mode 100644 index 00000000..0ec0b2fd --- /dev/null +++ b/SOURCES/lvm2-2_02_178-lvconvert-use-excl-activation-for-conversion.patch @@ -0,0 +1,156 @@ +From 8c34a9b06eab6c40a221730a1b72dcd5e43aabcc Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 12 Jan 2018 13:34:13 +0100 +Subject: [PATCH 13/25] lvconvert: use excl activation for conversion + +Use properly exclusive activation when reactivating origin after +snapshot merge (since origin must have been previously also exlusively +activated). + +Same applies when converting volumes to thin-pool or cache. + +Previously used 'only' local activation incorrectly allowed local +activation of some targets (i.e. raid) - thus 'leaking' chance to +activate same device on another node - which can be a problem +for device types like raid. + +(cherry picked from commit e86910b052ef50dfdaad104d17bda679f698e31f) + +Conflicts: + WHATS_NEW +--- + WHATS_NEW | 1 + + lib/metadata/cache_manip.c | 2 +- + lib/metadata/pool_manip.c | 6 +++--- + tools/lvconvert.c | 16 ++++++++-------- + 4 files changed, 13 insertions(+), 12 deletions(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 9375a86..c997206 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.178 - + ===================================== ++ Preserve exclusive activation during thin snaphost merge. + Avoid exceeding array bounds in allocation tag processing. + + Version 2.02.177 - 18th December 2017 +diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c +index 55ed724..97a3339 100644 +--- a/lib/metadata/cache_manip.c ++++ b/lib/metadata/cache_manip.c +@@ -960,7 +960,7 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv) + } + + cache_pool_lv->status |= LV_TEMPORARY; +- if (!activate_lv_local(cache_pool_lv->vg->cmd, cache_pool_lv)) { ++ if (!activate_lv_excl_local(cache_pool_lv->vg->cmd, cache_pool_lv)) { + log_error("Aborting. Failed to activate cache pool %s.", + display_lvname(cache_pool_lv)); + return 0; +diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c +index 18e4e65..b832db7 100644 +--- a/lib/metadata/pool_manip.c ++++ b/lib/metadata/pool_manip.c +@@ -526,7 +526,7 @@ int create_pool(struct logical_volume *pool_lv, + * or directly converted to invisible device via suspend/resume + */ + pool_lv->status |= LV_TEMPORARY; +- if (!activate_lv_local(pool_lv->vg->cmd, pool_lv)) { ++ if (!activate_lv_excl_local(pool_lv->vg->cmd, pool_lv)) { + log_error("Aborting. Failed to activate pool metadata %s.", + display_lvname(pool_lv)); + goto bad; +@@ -538,7 +538,7 @@ int create_pool(struct logical_volume *pool_lv, + } + pool_lv->status &= ~LV_TEMPORARY; + /* Deactivates cleared metadata LV */ +- if (!deactivate_lv_local(pool_lv->vg->cmd, pool_lv)) { ++ if (!deactivate_lv(pool_lv->vg->cmd, pool_lv)) { + log_error("Aborting. Could not deactivate pool metadata %s.", + display_lvname(pool_lv)); + return 0; +@@ -660,7 +660,7 @@ static struct logical_volume *_alloc_pool_metadata_spare(struct volume_group *vg + return_0; + + /* Spare LV should not be active */ +- if (!deactivate_lv_local(vg->cmd, lv)) { ++ if (!deactivate_lv(vg->cmd, lv)) { + log_error("Unable to deactivate pool metadata spare LV. " + "Manual intervention required."); + return 0; +diff --git a/tools/lvconvert.c b/tools/lvconvert.c +index deb7cc9..fee0a4e 100644 +--- a/tools/lvconvert.c ++++ b/tools/lvconvert.c +@@ -1970,14 +1970,14 @@ static int _lvconvert_snapshot(struct cmd_context *cmd, + log_warn("WARNING: %s not zeroed.", snap_name); + else { + lv->status |= LV_TEMPORARY; +- if (!activate_lv_local(cmd, lv) || ++ if (!activate_lv_excl_local(cmd, lv) || + !wipe_lv(lv, (struct wipe_params) { .do_zero = 1 })) { + log_error("Aborting. Failed to wipe snapshot exception store."); + return 0; + } + lv->status &= ~LV_TEMPORARY; + /* Deactivates cleared metadata LV */ +- if (!deactivate_lv_local(lv->vg->cmd, lv)) { ++ if (!deactivate_lv(lv->vg->cmd, lv)) { + log_error("Failed to deactivate zeroed snapshot exception store."); + return 0; + } +@@ -2170,7 +2170,7 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd, + log_print_unless_silent("Volume %s replaced origin %s.", + display_lvname(origin), display_lvname(lv)); + +- if (origin_is_active && !activate_lv(cmd, lv)) { ++ if (origin_is_active && !activate_lv_excl_local(cmd, lv)) { + log_error("Failed to reactivate origin %s.", + display_lvname(lv)); + return 0; +@@ -2278,13 +2278,13 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd, + return 0; + } + +- if (!activate_lv_local(cmd, pmslv)) { ++ if (!activate_lv_excl_local(cmd, pmslv)) { + log_error("Cannot activate pool metadata spare volume %s.", + pmslv->name); + return 0; + } + +- if (!activate_lv_local(cmd, mlv)) { ++ if (!activate_lv_excl_local(cmd, mlv)) { + log_error("Cannot activate thin pool metadata volume %s.", + mlv->name); + goto deactivate_pmslv; +@@ -2476,13 +2476,13 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd, + return 0; + } + +- if (!activate_lv_local(cmd, pmslv)) { ++ if (!activate_lv_excl_local(cmd, pmslv)) { + log_error("Cannot activate pool metadata spare volume %s.", + pmslv->name); + return 0; + } + +- if (!activate_lv_local(cmd, mlv)) { ++ if (!activate_lv_excl_local(cmd, mlv)) { + log_error("Cannot activate cache pool metadata volume %s.", + mlv->name); + goto deactivate_pmslv; +@@ -3130,7 +3130,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd, + + if (zero_metadata) { + metadata_lv->status |= LV_TEMPORARY; +- if (!activate_lv_local(cmd, metadata_lv)) { ++ if (!activate_lv_excl_local(cmd, metadata_lv)) { + log_error("Aborting. Failed to activate metadata lv."); + goto bad; + } +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-lvmlockd-add-lockopt-values-for-skipping-selected-lo.patch b/SOURCES/lvm2-2_02_178-lvmlockd-add-lockopt-values-for-skipping-selected-lo.patch new file mode 100644 index 00000000..81d98a05 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-lvmlockd-add-lockopt-values-for-skipping-selected-lo.patch @@ -0,0 +1,82 @@ +From 8a5e0083200db4b8d1ee2d4e95079372e75fd750 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Tue, 9 Jan 2018 11:18:57 -0600 +Subject: [PATCH 09/25] lvmlockd: add lockopt values for skipping selected + locks + +and add lockopt to common options. + +(cherry picked from commit 46cedb105bb7fdba0107794ca5801c2a0e8fd524) +--- + tools/command-lines.in | 9 ++++----- + tools/lvmcmdline.c | 10 ++++++++++ + 2 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/tools/command-lines.in b/tools/command-lines.in +index d0e5e06..a1776ce 100644 +--- a/tools/command-lines.in ++++ b/tools/command-lines.in +@@ -187,7 +187,7 @@ + # OO_ALL is included in every command automatically. + # + OO_ALL: --commandprofile String, --config String, --debug, +---driverloaded Bool, --help, --longhelp, --profile String, --quiet, ++--driverloaded Bool, --help, --lockopt String, --longhelp, --profile String, --quiet, + --verbose, --version, --yes, --test + + # +@@ -1524,19 +1524,18 @@ ID: vgchange_systemid + DESC: Change the system ID of a VG. + + vgchange --lockstart +-OO: --lockopt String, --select String ++OO: --select String + OP: VG|Tag|Select ... + ID: vgchange_lockstart + DESC: Start the lockspace of a shared VG in lvmlockd. + + vgchange --lockstop +-OO: --lockopt String, --select String ++OO: --select String + OP: VG|Tag|Select ... + ID: vgchange_lockstop + DESC: Stop the lockspace of a shared VG in lvmlockd. + + vgchange --locktype LockType VG +-OO: --lockopt String + ID: vgchange_locktype + DESC: Change the lock type for a shared VG. + +@@ -1563,7 +1562,7 @@ OO: --addtag Tag, --alloc Alloc, --autobackup Bool, --clustered Bool, --maxlogic + --physicalextentsize SizeMB, --force, --zero Bool, --labelsector Number, + --metadatasize SizeMB, --pvmetadatacopies MetadataCopiesPV, --vgmetadatacopies MetadataCopiesVG, + --reportformat ReportFmt, --dataalignment SizeKB, --dataalignmentoffset SizeKB, +---shared, --systemid String, --locktype LockType, --lockopt String ++--shared, --systemid String, --locktype LockType + ID: vgcreate_general + + --- +diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c +index b693722..791e272 100644 +--- a/tools/lvmcmdline.c ++++ b/tools/lvmcmdline.c +@@ -2682,6 +2682,16 @@ static int _init_lvmlockd(struct cmd_context *cmd) + return 1; + } + ++ if (use_lvmlockd && arg_is_set(cmd, lockopt_ARG)) { ++ const char *opts = arg_str_value(cmd, lockopt_ARG, ""); ++ if (strstr(opts, "skiplv")) ++ cmd->lockd_lv_disable = 1; ++ if (strstr(opts, "skipvg")) ++ cmd->lockd_vg_disable = 1; ++ if (strstr(opts, "skipgl")) ++ cmd->lockd_gl_disable = 1; ++ } ++ + if (use_lvmlockd && locking_is_clustered()) { + log_error("ERROR: configuration setting use_lvmlockd cannot be used with clustered locking_type 3."); + return 0; +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-lvmlockd-clear-coverity-complaint.patch b/SOURCES/lvm2-2_02_178-lvmlockd-clear-coverity-complaint.patch new file mode 100644 index 00000000..31fd92cd --- /dev/null +++ b/SOURCES/lvm2-2_02_178-lvmlockd-clear-coverity-complaint.patch @@ -0,0 +1,28 @@ +From d70ba36fbb7851979265d7635740111a6aee5937 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Mon, 18 Dec 2017 15:19:17 -0600 +Subject: [PATCH 07/25] lvmlockd: clear coverity complaint + +from previous coverity fix, it's never happy. + +(cherry picked from commit 3f9ae846b89a2963a4ca72cfa0281aab0bedcc02) +--- + lib/locking/lvmlockd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c +index 0365797..a4684b4 100644 +--- a/lib/locking/lvmlockd.c ++++ b/lib/locking/lvmlockd.c +@@ -2148,7 +2148,7 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg, + static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv, + const char *def_mode, uint32_t flags) + { +- struct logical_volume *pool_lv; ++ struct logical_volume *pool_lv = NULL; + + if (lv_is_thin_volume(lv)) { + struct lv_segment *pool_seg = first_seg(lv); +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-lvmlockd-print-warning-when-skipping-locking.patch b/SOURCES/lvm2-2_02_178-lvmlockd-print-warning-when-skipping-locking.patch new file mode 100644 index 00000000..aa2e6895 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-lvmlockd-print-warning-when-skipping-locking.patch @@ -0,0 +1,39 @@ +From 599ec3dafea034dfafe0d897a8d591f0d07bd016 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Tue, 9 Jan 2018 11:46:00 -0600 +Subject: [PATCH 10/25] lvmlockd: print warning when skipping locking + +(cherry picked from commit 51340888aab5e1b8630c7d8083e621ca0f4e4264) +--- + tools/lvmcmdline.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c +index 791e272..6be4bcd 100644 +--- a/tools/lvmcmdline.c ++++ b/tools/lvmcmdline.c +@@ -2684,12 +2684,18 @@ static int _init_lvmlockd(struct cmd_context *cmd) + + if (use_lvmlockd && arg_is_set(cmd, lockopt_ARG)) { + const char *opts = arg_str_value(cmd, lockopt_ARG, ""); +- if (strstr(opts, "skiplv")) ++ if (strstr(opts, "skiplv")) { ++ log_warn("WARNING: skipping LV lock in lvmlockd."); + cmd->lockd_lv_disable = 1; +- if (strstr(opts, "skipvg")) ++ } ++ if (strstr(opts, "skipvg")) { ++ log_warn("WARNING: skipping VG lock in lvmlockd."); + cmd->lockd_vg_disable = 1; +- if (strstr(opts, "skipgl")) ++ } ++ if (strstr(opts, "skipgl")) { ++ log_warn("WARNING: skipping global lock in lvmlockd."); + cmd->lockd_gl_disable = 1; ++ } + } + + if (use_lvmlockd && locking_is_clustered()) { +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-man-lvmlockd-remove-lv-resizing-comment.patch b/SOURCES/lvm2-2_02_178-man-lvmlockd-remove-lv-resizing-comment.patch new file mode 100644 index 00000000..e6b161c2 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-man-lvmlockd-remove-lv-resizing-comment.patch @@ -0,0 +1,27 @@ +From 356e4eeb33d8f75cabb8f0c416cf9f09766d70b9 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Wed, 10 Jan 2018 09:15:52 -0600 +Subject: [PATCH 11/25] man lvmlockd: remove lv resizing comment + +(cherry picked from commit 943b21779770f1cd93e73925e62f108e2efbd6cc) +--- + man/lvmlockd.8_main | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main +index bb45871..6f982bd 100644 +--- a/man/lvmlockd.8_main ++++ b/man/lvmlockd.8_main +@@ -862,9 +862,6 @@ vgsplit + .br + \[bu] + vgmerge +-.br +-\[bu] +-resizing an LV that is active in the shared mode on multiple hosts + + + .SS lvmlockd changes from clvmd +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-man-lvmlockd-update-wording.patch b/SOURCES/lvm2-2_02_178-man-lvmlockd-update-wording.patch new file mode 100644 index 00000000..90e78f39 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-man-lvmlockd-update-wording.patch @@ -0,0 +1,26 @@ +From 52fd5414cb31c4c92344e8fe9a4f137cdaabea7a Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Tue, 2 Jan 2018 13:10:34 -0600 +Subject: [PATCH 08/25] man lvmlockd: update wording + +(cherry picked from commit 96801ac0859798c4e478d05e91aaa68b4ce10c91) +--- + man/lvmlockd.8_main | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main +index fbcdc87..bb45871 100644 +--- a/man/lvmlockd.8_main ++++ b/man/lvmlockd.8_main +@@ -15,7 +15,7 @@ coordinate reading and writing of LVM metadata + validate caching of LVM metadata + .br + \[bu] +-prevent concurrent activation of logical volumes ++prevent conflicting activation of logical volumes + .br + + lvmlockd uses an external lock manager to perform basic locking. +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-mirror-Add-deprecation-warning-for-mirrored-log.patch b/SOURCES/lvm2-2_02_178-mirror-Add-deprecation-warning-for-mirrored-log.patch new file mode 100644 index 00000000..f1a0b7fd --- /dev/null +++ b/SOURCES/lvm2-2_02_178-mirror-Add-deprecation-warning-for-mirrored-log.patch @@ -0,0 +1,74 @@ + WHATS_NEW | 1 + + lib/metadata/mirror.c | 4 ++++ + tools/lvconvert.c | 11 ++++++++--- + 3 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index da10eed..762553f 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.178 - + ===================================== ++ Add deprecate messages for usage of mirrors with mirrorlog. + Restore pvmove support for wide-clustered active volumes (2.02.177). + Avoid non-exclusive activation of exclusive segment types. + Fix trimming sibling PVs when doing a pvmove of raid subLVs. +diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c +index 38c3df6..4a0e99f 100644 +--- a/lib/metadata/mirror.c ++++ b/lib/metadata/mirror.c +@@ -1945,6 +1945,10 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv, + return 1; + } + ++ if (log_count > 1) { ++ log_warn("WARNING: Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead."); ++ } ++ + if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 0))) + return_0; + +diff --git a/tools/lvconvert.c b/tools/lvconvert.c +index fee0a4e..8006699 100644 +--- a/tools/lvconvert.c ++++ b/tools/lvconvert.c +@@ -686,7 +686,7 @@ static void _remove_missing_empty_pv(struct volume_group *vg, struct dm_list *re + stack; + return; + } +- log_warn("%d missing and now unallocated Physical Volumes removed from VG.", removed); ++ log_warn("WARNING: %d missing and now unallocated Physical Volumes removed from VG.", removed); + } + } + +@@ -828,7 +828,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd, + uint32_t old_log_count = _get_log_count(lv); + + if ((lp->mirrors == 1) && !lv_is_mirrored(lv)) { +- log_warn("Logical volume %s is already not mirrored.", ++ log_warn("WARNING: Logical volume %s is already not mirrored.", + display_lvname(lv)); + return 1; + } +@@ -1100,7 +1100,7 @@ static int _lvconvert_mirrors_repair(struct cmd_context *cmd, + log_count = replace_logs ? original_logs : (original_logs - failed_logs); + + while (replace_mimages || replace_logs) { +- log_warn("Trying to up-convert to %d images, %d logs.", lp->mirrors, log_count); ++ log_warn("WARNING: Trying to up-convert to %d images, %d logs.", lp->mirrors, log_count); + if (_lvconvert_mirrors_aux(cmd, lv, lp, NULL, + lp->mirrors, log_count, pvh)) + break; +@@ -1216,6 +1216,11 @@ static int _lvconvert_mirrors(struct cmd_context *cmd, + (old_log_count == new_log_count)) + return 1; + ++ if ((old_log_count != new_log_count) && ++ (new_log_count == MIRROR_LOG_MIRRORED)) { ++ log_warn("WARNING: Log type \"mirrored\" is DEPRECATED and will be removed in the future. Use RAID1 LV or disk log instead."); ++ } ++ + if (!_lvconvert_mirrors_aux(cmd, lv, lp, NULL, + new_mimage_count, new_log_count, lp->pvh)) + return_0; diff --git a/SOURCES/lvm2-2_02_178-pvmove-better-check-for-exclusive-LV.patch b/SOURCES/lvm2-2_02_178-pvmove-better-check-for-exclusive-LV.patch new file mode 100644 index 00000000..9f1ae45d --- /dev/null +++ b/SOURCES/lvm2-2_02_178-pvmove-better-check-for-exclusive-LV.patch @@ -0,0 +1,28 @@ +From d21e2b6005f656c1600bb49942f585d001e94839 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 12 Jan 2018 15:59:07 +0100 +Subject: [PATCH 15/25] pvmove: better check for exclusive LV + +(cherry picked from commit 5a961d3411c8c11312d2998378277efc8988fc7f) +--- + tools/pvmove.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index 39cf25f..9bbe12b 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -451,7 +451,9 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + } + + if (vg_is_clustered(vg) && +- lv_is_active_exclusive_remotely(lv)) { ++ lv_is_visible(lv) && ++ lv_is_active(lv) && ++ !lv_is_active_exclusive_locally(lv)) { + lv_skipped = 1; + log_print_unless_silent("Skipping LV %s which is activated " + "exclusively on remote node.", lv->name); +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-pvmove-drop-misleading-pvmove-restriction-for-cluste.patch b/SOURCES/lvm2-2_02_178-pvmove-drop-misleading-pvmove-restriction-for-cluste.patch new file mode 100644 index 00000000..f6a6d6a2 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-pvmove-drop-misleading-pvmove-restriction-for-cluste.patch @@ -0,0 +1,38 @@ +From 00277d60e98409e493f6208f7f541f7b85ace91f Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 11 Jan 2018 16:15:16 +0100 +Subject: [PATCH 16/25] pvmove: drop misleading pvmove restriction for cluster + +pvmove handles properly locked LVs in cluster and this extra check +actually cause misbehavior as some LVs were silently skipped from +operation scope. + +(cherry picked from commit 02621cffb0d5ff72adb8770e26c1b4adb95bd0d9) +--- + tools/pvmove.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index 9bbe12b..c5d7e52 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -371,16 +371,6 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + if (lv_name && strcmp(lv->name, top_level_lv_name(vg, lv_name))) + continue; + +- /* +- * RAID, thin and snapshot-related LVs are not +- * processed in a cluster, so we don't have to +- * worry about avoiding certain PVs in that context. +- * +- * Allow clustered mirror, but not raid mirror. +- */ +- if (vg_is_clustered(vg) && !lv_is_mirror_type(lv)) +- continue; +- + if (!lv_is_on_pvs(lv, source_pvl)) + continue; + +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-pvmove-enhance-accepted-states-of-active-LVs.patch b/SOURCES/lvm2-2_02_178-pvmove-enhance-accepted-states-of-active-LVs.patch new file mode 100644 index 00000000..8970948a --- /dev/null +++ b/SOURCES/lvm2-2_02_178-pvmove-enhance-accepted-states-of-active-LVs.patch @@ -0,0 +1,156 @@ + tools/pvmove.c | 97 ++++++++++++++++++++++++++++++++-------------------------- + 1 file changed, 54 insertions(+), 43 deletions(-) + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index cbd5cb8..2a26a10 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -340,8 +340,8 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + uint32_t log_count = 0; + int lv_found = 0; + int lv_skipped = 0; +- int lv_active_count = 0; +- int lv_exclusive_count = 0; ++ int needs_exclusive = *exclusive; ++ const struct logical_volume *holder; + + /* FIXME Cope with non-contiguous => splitting existing segments */ + if (!(lv_mirr = lv_create_empty("pvmove%d", NULL, +@@ -392,8 +392,13 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + return NULL; + } + +- if (seg_is_raid(first_seg(lv)) || +- seg_is_mirrored(first_seg(lv))) { ++ seg = first_seg(lv); ++ ++ /* Presence of exclusive LV decides whether pvmove must be also exclusive */ ++ if ((seg_only_exclusive(seg) || lv_is_origin(lv) || lv_is_cow(lv))) ++ needs_exclusive = 1; ++ ++ if (seg_is_raid(seg) || seg_is_mirrored(seg)) { + dm_list_init(&trim_list); + + if (!get_pv_list_for_lv(vg->cmd->mem, lv, &trim_list)) +@@ -432,6 +437,14 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + lv_found = 1; + } + ++ seg = first_seg(lv); ++ ++ if (seg_is_cache(seg) || seg_is_cache_pool(seg) || ++ seg_is_mirrored(seg) || seg_is_raid(seg) || ++ seg_is_snapshot(seg) || ++ seg_is_thin(seg) || seg_is_thin_pool(seg)) ++ continue; /* bottom-level LVs only... */ ++ + if (!lv_is_on_pvs(lv, source_pvl)) + continue; + +@@ -441,47 +454,36 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + continue; + } + +- if (vg_is_clustered(vg) && lv_is_visible(lv)) { +- if (lv_is_active_exclusive_locally(lv)) { +- if (lv_active_count) { +- log_error("Cannot move in clustered VG %s " +- "if some LVs are activated " +- "exclusively while others don't.", +- vg->name); +- return NULL; +- } +- +- lv_exclusive_count++; +- } else if (lv_is_active(lv)) { +- if (seg_only_exclusive(first_seg(lv))) { +- lv_skipped = 1; +- log_print_unless_silent("Skipping LV %s which is active, " +- "but not locally exclusively.", +- display_lvname(lv)); +- continue; +- } +- +- if (*exclusive) { +- log_error("Cannot move in clustered VG %s, " +- "clustered mirror (cmirror) not detected " +- "and LVs are activated non-exclusively.", +- vg->name); +- return NULL; +- } +- +- lv_active_count++; +- } +- } ++ holder = lv_lock_holder(lv); + +- seg = first_seg(lv); +- if (seg_is_raid(seg) || seg_is_mirrored(seg) || +- seg_is_cache(seg) || seg_is_cache_pool(seg) || +- seg_is_thin(seg) || seg_is_thin_pool(seg)) +- /* +- * Pass over top-level LVs - they were handled. +- * Allow sub-LVs to proceed. ++ if (needs_exclusive) { ++ /* With exclusive pvmove skip LV when: ++ * - is active remotely ++ * - is not active locally and cannot be activated exclusively locally ++ * ++ * Note: lvm2 can proceed with exclusive pvmove for 'just' locally active LVs ++ * in the case it's NOT active anywhere else, since LOCKED LVs cannot be ++ * later activated by user. + */ ++ if (lv_is_active_remotely(holder) || ++ (!lv_is_active_locally(holder) && !activate_lv_excl_local(cmd, holder))) { ++ lv_skipped = 1; ++ log_print_unless_silent("Skipping LV %s which is not locally exclusive%s.", ++ display_lvname(lv), ++ /* Report missing cmirrord cases that matterd. ++ * With exclusive LV types cmirrord would not help. */ ++ (*exclusive && ++ !lv_is_origin(holder) && ++ !seg_only_exclusive(first_seg(holder))) ? ++ " and clustered mirror (cmirror) not detected" : ""); ++ continue; ++ } ++ } else if (!activate_lv(cmd, holder)) { ++ lv_skipped = 1; ++ log_print_unless_silent("Skipping LV %s which cannot be activated.", ++ display_lvname(lv)); + continue; ++ } + + if (!_insert_pvmove_mirrors(cmd, lv_mirr, source_pvl, lv, + *lvs_changed)) +@@ -517,7 +519,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + return NULL; + } + +- if (lv_exclusive_count) ++ if (needs_exclusive) + *exclusive = 1; + + return lv_mirr; +@@ -600,6 +602,8 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + struct dm_list *lvs_changed; + struct logical_volume *lv_mirr; + struct logical_volume *lv = NULL; ++ struct lv_list *lvl; ++ const struct logical_volume *lvh; + const char *pv_name = pv_dev_name(pv); + unsigned flags = PVMOVE_FIRST_TIME; + unsigned exclusive; +@@ -661,6 +665,13 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + goto out; + } + ++ dm_list_iterate_items(lvl, lvs_changed) { ++ lvh = lv_lock_holder(lvl->lv); ++ /* Exclusive LV decides whether pvmove must be also exclusive */ ++ if (lv_is_origin(lvh) || seg_only_exclusive(first_seg(lvh))) ++ exclusive = 1; ++ } ++ + /* Ensure mirror LV is active */ + if (!_activate_lv(cmd, lv_mirr, exclusive)) { + log_error("ABORTING: Temporary mirror activation failed."); diff --git a/SOURCES/lvm2-2_02_178-pvmove-fix-_remove_sibling_pvs_from_trim_list.patch b/SOURCES/lvm2-2_02_178-pvmove-fix-_remove_sibling_pvs_from_trim_list.patch new file mode 100644 index 00000000..411465a9 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-pvmove-fix-_remove_sibling_pvs_from_trim_list.patch @@ -0,0 +1,70 @@ +From 9c3e21e2483fa1818ff4ff4792aaec1d4ea437f8 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 11 Jan 2018 13:21:08 +0100 +Subject: [PATCH 14/25] pvmove: fix _remove_sibling_pvs_from_trim_list + +Fix the function to really check it sibling raid image LV. +For LV_rmeta_0 check for LV_rimage_0 instead of +LV_rmeta_0rimage_0. + +(cherry picked from commit 7c6fb63041cd5c1fb899cc468d0a5cf23a01abbe) +--- + WHATS_NEW | 1 + + tools/pvmove.c | 16 +++++++++++++--- + 2 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index c997206..4368543 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.178 - + ===================================== ++ Fix trimming sibling PVs when doing a pvmove of raid subLVs. + Preserve exclusive activation during thin snaphost merge. + Avoid exceeding array bounds in allocation tag processing. + +diff --git a/tools/pvmove.c b/tools/pvmove.c +index 7bf1713..39cf25f 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -145,6 +145,7 @@ static int _remove_sibling_pvs_from_trim_list(struct logical_volume *lv, + struct dm_list *trim_list) + { + char *idx, *suffix; ++ const char *sibling; + char sublv_name[NAME_LEN]; + struct logical_volume *sublv; + struct dm_list untrim_list, *pvh1, *pvh2; +@@ -159,7 +160,16 @@ static int _remove_sibling_pvs_from_trim_list(struct logical_volume *lv, + + dm_list_init(&untrim_list); + +- if (!(suffix = first_substring(lv_name, "_rimage_", "_rmeta_", NULL))) { ++ if (!dm_strncpy(sublv_name, lv_name, sizeof(sublv_name))) { ++ log_error(INTERNAL_ERROR "LV name %s is too long.", lv_name); ++ return 0; ++ } ++ ++ if ((suffix = strstr(sublv_name, "_rimage_"))) ++ sibling = "meta"; ++ else if ((suffix = strstr(sublv_name, "_rmeta_"))) ++ sibling = "image"; ++ else { + log_error("Can't find rimage or rmeta suffix."); + return 0; + } +@@ -171,8 +181,8 @@ static int _remove_sibling_pvs_from_trim_list(struct logical_volume *lv, + idx++; + + /* Create the siblings name (e.g. "raidlv_rmeta_N" -> "raidlv_rimage_N" */ +- if (dm_snprintf(sublv_name, sizeof(sublv_name), "%s_r%s_%s", lv_name, +- strstr(suffix, "_rimage_") ? "meta" : "image", idx) < 0) { ++ if (dm_snprintf(suffix + 2, sizeof(sublv_name) - 2 - (suffix - sublv_name), ++ "%s_%s", sibling, idx) < 0) { + log_error("Raid sublv for name %s too long.", lv_name); + return 0; + } +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-pvmove-reinstantiate-clustered-pvmove.patch b/SOURCES/lvm2-2_02_178-pvmove-reinstantiate-clustered-pvmove.patch new file mode 100644 index 00000000..1c48301f --- /dev/null +++ b/SOURCES/lvm2-2_02_178-pvmove-reinstantiate-clustered-pvmove.patch @@ -0,0 +1,280 @@ + WHATS_NEW | 1 + + lib/activate/activate.c | 1 - + lib/locking/locking.c | 12 ++++-- + lib/locking/locking.h | 2 +- + tools/pvmove.c | 109 ++++++++++++++++++++++++++++++++++++------------ + 5 files changed, 93 insertions(+), 32 deletions(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index c3117de..da10eed 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.178 - + ===================================== ++ Restore pvmove support for wide-clustered active volumes (2.02.177). + Avoid non-exclusive activation of exclusive segment types. + Fix trimming sibling PVs when doing a pvmove of raid subLVs. + Preserve exclusive activation during thin snaphost merge. +diff --git a/lib/activate/activate.c b/lib/activate/activate.c +index 18cc7cf..7a37130 100644 +--- a/lib/activate/activate.c ++++ b/lib/activate/activate.c +@@ -2576,7 +2576,6 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s, + + if (!laopts->exclusive && + (lv_is_origin(lv) || +- lv_is_pvmove(lv) || + seg_only_exclusive(first_seg(lv)))) { + log_error(INTERNAL_ERROR "Trying non-exlusive activation of %s with " + "a volume type %s requiring exclusive activation.", +diff --git a/lib/locking/locking.c b/lib/locking/locking.c +index 8daa61e..1a3ce9d 100644 +--- a/lib/locking/locking.c ++++ b/lib/locking/locking.c +@@ -399,15 +399,19 @@ int activate_lv_excl(struct cmd_context *cmd, const struct logical_volume *lv) + } + + /* Lock a list of LVs */ +-int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs) ++int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive) + { + struct dm_list *lvh; + struct lv_list *lvl; + + dm_list_iterate_items(lvl, lvs) { +- if (!activate_lv_excl_local(cmd, lvl->lv)) { +- log_error("Failed to locally exclusively activate %s.", +- display_lvname(lvl->lv)); ++ if (!exclusive && !lv_is_active_exclusive(lvl->lv)) { ++ if (!activate_lv(cmd, lvl->lv)) { ++ log_error("Failed to activate %s", display_lvname(lvl->lv)); ++ return 0; ++ } ++ } else if (!activate_lv_excl(cmd, lvl->lv)) { ++ log_error("Failed to activate %s", display_lvname(lvl->lv)); + dm_list_uniterate(lvh, lvs, &lvl->list) { + lvl = dm_list_item(lvh, struct lv_list); + if (!deactivate_lv(cmd, lvl->lv)) +diff --git a/lib/locking/locking.h b/lib/locking/locking.h +index 47841ed..f2fbb00 100644 +--- a/lib/locking/locking.h ++++ b/lib/locking/locking.h +@@ -262,6 +262,6 @@ int sync_dev_names(struct cmd_context* cmd); + + /* Process list of LVs */ + struct volume_group; +-int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs); ++int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive); + + #endif +diff --git a/tools/pvmove.c b/tools/pvmove.c +index b3d1d89..cbd5cb8 100644 +--- a/tools/pvmove.c ++++ b/tools/pvmove.c +@@ -64,6 +64,16 @@ static int _pvmove_target_present(struct cmd_context *cmd, int clustered) + return found; + } + ++static unsigned _pvmove_is_exclusive(struct cmd_context *cmd, ++ struct volume_group *vg) ++{ ++ if (vg_is_clustered(vg)) ++ if (!_pvmove_target_present(cmd, 1)) ++ return 1; ++ ++ return 0; ++} ++ + /* Allow /dev/vgname/lvname, vgname/lvname or lvname */ + static const char *_extract_lvname(struct cmd_context *cmd, const char *vgname, + const char *arg) +@@ -320,7 +330,8 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + const char *lv_name, + struct dm_list *allocatable_pvs, + alloc_policy_t alloc, +- struct dm_list **lvs_changed) ++ struct dm_list **lvs_changed, ++ unsigned *exclusive) + { + struct logical_volume *lv_mirr, *lv; + struct lv_segment *seg; +@@ -329,6 +340,8 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + uint32_t log_count = 0; + int lv_found = 0; + int lv_skipped = 0; ++ int lv_active_count = 0; ++ int lv_exclusive_count = 0; + + /* FIXME Cope with non-contiguous => splitting existing segments */ + if (!(lv_mirr = lv_create_empty("pvmove%d", NULL, +@@ -422,33 +435,54 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + if (!lv_is_on_pvs(lv, source_pvl)) + continue; + +- seg = first_seg(lv); +- if (seg_is_raid(seg) || seg_is_mirrored(seg) || +- lv_is_thin_volume(lv) || lv_is_thin_pool(lv)) { +- /* +- * Pass over top-level LVs - they were handled. +- * Allow sub-LVs to proceed. +- */ +- continue; +- } +- + if (lv_is_locked(lv)) { + lv_skipped = 1; + log_print_unless_silent("Skipping locked LV %s.", display_lvname(lv)); + continue; + } + +- if (vg_is_clustered(vg) && +- lv_is_visible(lv) && +- lv_is_active(lv) && +- !lv_is_active_exclusive_locally(lv)) { +- lv_skipped = 1; +- log_print_unless_silent("Skipping LV %s which is active, " +- "but not locally exclusively.", +- display_lvname(lv)); +- continue; ++ if (vg_is_clustered(vg) && lv_is_visible(lv)) { ++ if (lv_is_active_exclusive_locally(lv)) { ++ if (lv_active_count) { ++ log_error("Cannot move in clustered VG %s " ++ "if some LVs are activated " ++ "exclusively while others don't.", ++ vg->name); ++ return NULL; ++ } ++ ++ lv_exclusive_count++; ++ } else if (lv_is_active(lv)) { ++ if (seg_only_exclusive(first_seg(lv))) { ++ lv_skipped = 1; ++ log_print_unless_silent("Skipping LV %s which is active, " ++ "but not locally exclusively.", ++ display_lvname(lv)); ++ continue; ++ } ++ ++ if (*exclusive) { ++ log_error("Cannot move in clustered VG %s, " ++ "clustered mirror (cmirror) not detected " ++ "and LVs are activated non-exclusively.", ++ vg->name); ++ return NULL; ++ } ++ ++ lv_active_count++; ++ } + } + ++ seg = first_seg(lv); ++ if (seg_is_raid(seg) || seg_is_mirrored(seg) || ++ seg_is_cache(seg) || seg_is_cache_pool(seg) || ++ seg_is_thin(seg) || seg_is_thin_pool(seg)) ++ /* ++ * Pass over top-level LVs - they were handled. ++ * Allow sub-LVs to proceed. ++ */ ++ continue; ++ + if (!_insert_pvmove_mirrors(cmd, lv_mirr, source_pvl, lv, + *lvs_changed)) + return_NULL; +@@ -483,15 +517,35 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd, + return NULL; + } + ++ if (lv_exclusive_count) ++ *exclusive = 1; ++ + return lv_mirr; + } + ++static int _activate_lv(struct cmd_context *cmd, struct logical_volume *lv_mirr, ++ unsigned exclusive) ++{ ++ int r = 0; ++ ++ if (exclusive || lv_is_active_exclusive(lv_mirr)) ++ r = activate_lv_excl(cmd, lv_mirr); ++ else ++ r = activate_lv(cmd, lv_mirr); ++ ++ if (!r) ++ stack; ++ ++ return r; ++} ++ + /* + * Called to set up initial pvmove LV only. + * (Not called after first or any other section completes.) + */ + static int _update_metadata(struct logical_volume *lv_mirr, +- struct dm_list *lvs_changed) ++ struct dm_list *lvs_changed, ++ unsigned exclusive) + { + struct lv_list *lvl; + struct logical_volume *lv = lv_mirr; +@@ -505,7 +559,7 @@ static int _update_metadata(struct logical_volume *lv_mirr, + return_0; + + /* Ensure mirror LV is active */ +- if (!activate_lv_excl_local(lv_mirr->vg->cmd, lv_mirr)) { ++ if (!_activate_lv(lv_mirr->vg->cmd, lv_mirr, exclusive)) { + if (test_mode()) + return 1; + +@@ -548,6 +602,7 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + struct logical_volume *lv = NULL; + const char *pv_name = pv_dev_name(pv); + unsigned flags = PVMOVE_FIRST_TIME; ++ unsigned exclusive; + int r = ECMD_FAILED; + + pp->found_pv = 1; +@@ -594,6 +649,8 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + } + } + ++ exclusive = _pvmove_is_exclusive(cmd, vg); ++ + if ((lv_mirr = find_pvmove_lv(vg, pv_dev(pv), PVMOVE))) { + log_print_unless_silent("Detected pvmove in progress for %s.", pv_name); + if (pp->pv_count || lv_name) +@@ -605,7 +662,7 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + } + + /* Ensure mirror LV is active */ +- if (!activate_lv_excl_local(cmd, lv_mirr)) { ++ if (!_activate_lv(cmd, lv_mirr, exclusive)) { + log_error("ABORTING: Temporary mirror activation failed."); + goto out; + } +@@ -630,12 +687,12 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + + if (!(lv_mirr = _set_up_pvmove_lv(cmd, vg, source_pvl, lv_name, + allocatable_pvs, pp->alloc, +- &lvs_changed))) ++ &lvs_changed, &exclusive))) + goto_out; + } + + /* Lock lvs_changed and activate (with old metadata) */ +- if (!activate_lvs(cmd, lvs_changed)) ++ if (!activate_lvs(cmd, lvs_changed, exclusive)) + goto_out; + + /* FIXME Presence of a mirror once set PVMOVE - now remove associated logic */ +@@ -646,7 +703,7 @@ static int _pvmove_setup_single(struct cmd_context *cmd, + goto out; + + if (flags & PVMOVE_FIRST_TIME) +- if (!_update_metadata(lv_mirr, lvs_changed)) ++ if (!_update_metadata(lv_mirr, lvs_changed, exclusive)) + goto_out; + + /* LVs are all in status LOCKED */ diff --git a/SOURCES/lvm2-2_02_178-tests-check-preserved-exclusivness-of-snapshot-merge.patch b/SOURCES/lvm2-2_02_178-tests-check-preserved-exclusivness-of-snapshot-merge.patch new file mode 100644 index 00000000..ac295c63 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-tests-check-preserved-exclusivness-of-snapshot-merge.patch @@ -0,0 +1,52 @@ +From 509497ae21a4c84f4714835c6f8017a66b666308 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Mon, 15 Jan 2018 13:29:14 +0100 +Subject: [PATCH 22/25] tests: check preserved exclusivness of snapshot merge + +Detect if origin remains exclusively activated after merging. + +(cherry picked from commit 8ebd45fde759c438e854d6b4f02f0e9803094fea) +--- + test/shell/snapshot-merge.sh | 4 ++++ + test/shell/thin-merge.sh | 9 +++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/test/shell/snapshot-merge.sh b/test/shell/snapshot-merge.sh +index 9d0a264..41e7b00 100644 +--- a/test/shell/snapshot-merge.sh ++++ b/test/shell/snapshot-merge.sh +@@ -54,7 +54,11 @@ setup_merge_ $vg $lv1 + + # make sure lvconvert --merge requires explicit LV listing + not lvconvert --merge ++ ++# check exclusive lock is preserved after merge ++check lv_field "$vg/$lv1" lv_active_exclusively "active exclusively" + lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")" ++check lv_field "$vg/$lv1" lv_active_exclusively "active exclusively" + lvremove -f $vg/$lv1 + + setup_merge_ $vg $lv1 +diff --git a/test/shell/thin-merge.sh b/test/shell/thin-merge.sh +index 3abda40..24dec96 100644 +--- a/test/shell/thin-merge.sh ++++ b/test/shell/thin-merge.sh +@@ -30,6 +30,15 @@ aux have_thin 1 0 0 || skip + aux prepare_vg 2 + + lvcreate -T -L8M $vg/pool -V10M -n $lv1 ++lvcreate -s -K -n snap $vg/$lv1 ++# check exclusive lock is preserved after merge ++check lv_field "$vg/$lv1" lv_active_exclusively "active exclusively" ++lvconvert --merge $vg/snap ++check lv_field "$vg/$lv1" lv_active_exclusively "active exclusively" ++lvremove -ff $vg ++ ++ ++lvcreate -T -L8M $vg/pool -V10M -n $lv1 + lvchange --addtag tagL $vg/$lv1 + + mkdir mnt +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-tests-check-pvmove-is-merging-segments.patch b/SOURCES/lvm2-2_02_178-tests-check-pvmove-is-merging-segments.patch new file mode 100644 index 00000000..a1885f6c --- /dev/null +++ b/SOURCES/lvm2-2_02_178-tests-check-pvmove-is-merging-segments.patch @@ -0,0 +1,48 @@ +From c3a9e28b2dad569fc39f36e90408a8a8f6357d5a Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Fri, 1 Dec 2017 11:58:38 +0100 +Subject: [PATCH 24/25] tests: check pvmove is merging segments + +pvmove was imporoved to properly merge consqutive segments after pvmove +so check it's working. + +(cherry picked from commit e16d309d5651d1697f5246855ae816302cd8516f) +--- + test/shell/pvmove-all-segtypes.sh | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/test/shell/pvmove-all-segtypes.sh b/test/shell/pvmove-all-segtypes.sh +index e10586e..f672290 100644 +--- a/test/shell/pvmove-all-segtypes.sh ++++ b/test/shell/pvmove-all-segtypes.sh +@@ -29,12 +29,22 @@ aux prepare_vg 5 20 + # Testing pvmove of linear LV + lvcreate -aey -l 2 -n ${lv1}_foo $vg "$dev1" + lvcreate -aey -l 2 -n $lv1 $vg "$dev1" +-check lv_tree_on $vg ${lv1}_foo "$dev1" +-check lv_tree_on $vg $lv1 "$dev1" ++lvextend -l+2 $vg/${lv1}_foo "$dev1" ++lvextend -l+2 $vg/${lv1} "$dev1" ++lvextend -l+2 $vg/${lv1}_foo "$dev2" ++lvextend -l+2 $vg/${lv1} "$dev3" ++check lv_tree_on $vg ${lv1}_foo "$dev1" "$dev2" ++check lv_tree_on $vg $lv1 "$dev1" "$dev3" ++check lv_field $vg/${lv1}_foo seg_count 3 ++check lv_field $vg/$lv1 seg_count 3 + aux mkdev_md5sum $vg $lv1 +-pvmove "$dev1" "$dev5" +-check lv_tree_on $vg ${lv1}_foo "$dev5" +-check lv_tree_on $vg $lv1 "$dev5" ++dmsetup table ++pvmove --atomic "$dev1" "$dev5" ++check lv_tree_on $vg ${lv1}_foo "$dev2" "$dev5" ++check lv_tree_on $vg $lv1 "$dev3" "$dev5" ++# Also check 2 segments from $dev1 were merged on $dev5 ++check lv_field $vg/${lv1}_foo seg_count 2 ++check lv_field $vg/$lv1 seg_count 2 + check dev_md5sum $vg $lv1 + pvmove -n $lv1 "$dev5" "$dev4" + check lv_tree_on $vg $lv1 "$dev4" +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-tests-longer-startup-timeout-for-daemons-with-valgri.patch b/SOURCES/lvm2-2_02_178-tests-longer-startup-timeout-for-daemons-with-valgri.patch new file mode 100644 index 00000000..d9235e52 --- /dev/null +++ b/SOURCES/lvm2-2_02_178-tests-longer-startup-timeout-for-daemons-with-valgri.patch @@ -0,0 +1,63 @@ +From b32a169b079a67629304c146aad65c2d79acfe01 Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Mon, 15 Jan 2018 16:26:34 +0100 +Subject: [PATCH 23/25] tests: longer startup timeout for daemons with valgrind + +It's getting noticable somewhat slower... + +(cherry picked from commit 5baf2de8986ceeb353c39ccf0503f9fefcb6eb92) +--- + test/lib/aux.sh | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/test/lib/aux.sh b/test/lib/aux.sh +index 6bc7bd4..f30dfdd 100644 +--- a/test/lib/aux.sh ++++ b/test/lib/aux.sh +@@ -180,8 +180,8 @@ prepare_clvmd() { + LVM_LOG_FILE_EPOCH=CLVMD LVM_LOG_FILE_MAX_LINES=1000000 LVM_BINARY=$(which lvm) $run_valgrind clvmd -Isinglenode -d 1 -f & + echo $! > LOCAL_CLVMD + +- for i in {1..100} ; do +- test "$i" -eq 100 && die "Startup of clvmd is too slow." ++ for i in {200..0} ; do ++ test "$i" -eq 0 && die "Startup of clvmd is too slow." + test -e "$CLVMD_PIDFILE" && test -e "${CLVMD_PIDFILE%/*}/lvm/clvmd.sock" && break + echo -n . + sleep .1 +@@ -205,8 +205,8 @@ prepare_dmeventd() { + echo $! > LOCAL_DMEVENTD + + # FIXME wait for pipe in /var/run instead +- for i in {1..100} ; do +- test "$i" -eq 100 && die "Startup of dmeventd is too slow." ++ for i in {200..0} ; do ++ test "$i" -eq 0 && die "Startup of dmeventd is too slow." + test -e "${DMEVENTD_PIDFILE}" && break + echo -n . + sleep .1 +@@ -230,8 +230,8 @@ prepare_lvmetad() { + $run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" \ + ${LVM_TEST_LVMETAD_DEBUG_OPTS--l all} & + echo $! > LOCAL_LVMETAD +- for i in {1..100} ; do +- test "$i" -eq 100 && die "Startup of lvmetad is too slow." ++ for i in {200..0} ; do ++ test "$i" -eq 0 && die "Startup of lvmetad is too slow." + test -e "$TESTDIR/lvmetad.socket" && break + echo -n . + sleep .1; +@@ -280,8 +280,8 @@ prepare_lvmpolld() { + echo -n "## preparing lvmpolld..." + $run_valgrind lvmpolld -f "$@" -s "$TESTDIR/lvmpolld.socket" -B "$TESTDIR/lib/lvm" -l all & + echo $! > LOCAL_LVMPOLLD +- for i in {1..100} ; do +- test "$i" -eq 100 && die "Startup of lvmpolld is too slow." ++ for i in {200..0} ; do ++ test "$i" -eq 0 && die "Startup of lvmpolld is too slow." + test -e "$TESTDIR/lvmpolld.socket" && break + echo -n .; + sleep .1; +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-2_02_178-tests-properly-test-with-clustered-VG.patch b/SOURCES/lvm2-2_02_178-tests-properly-test-with-clustered-VG.patch new file mode 100644 index 00000000..1029b8ec --- /dev/null +++ b/SOURCES/lvm2-2_02_178-tests-properly-test-with-clustered-VG.patch @@ -0,0 +1,145 @@ +From 42dd15665401075992d390ed034793c5c036e11f Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac +Date: Thu, 11 Jan 2018 16:05:44 +0100 +Subject: [PATCH 21/25] tests: properly test with clustered VG + +Testing in cluster makes sense only with clustered VG. + +(cherry picked from commit 8c7ec44bf0fb23e2c5e426c5d07b02e3d25f5b59) +--- + test/shell/pvmove-basic.sh | 10 +++++----- + test/shell/pvmove-raid-segtypes.sh | 14 +++++++------- + test/shell/pvmove-thin-segtypes.sh | 14 +++++++------- + 3 files changed, 19 insertions(+), 19 deletions(-) + +diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh +index 056274d..42f165b 100644 +--- a/test/shell/pvmove-basic.sh ++++ b/test/shell/pvmove-basic.sh +@@ -26,15 +26,15 @@ which md5sum || skip + # Utilities + + create_vg_() { +- vgcreate -c n -s 128k "$vg" "${DEVICES[@]}" ++ vgcreate -s 128k "$vg" "${DEVICES[@]}" + } + + # --------------------------------------------------------------------- + # Common environment setup/cleanup for each sub testcases + prepare_lvs_() { +- lvcreate -l2 -n $lv1 $vg "$dev1" ++ lvcreate -aey -l2 -n $lv1 $vg "$dev1" + check lv_on $vg $lv1 "$dev1" +- lvcreate -l9 -i3 -n $lv2 $vg "$dev2" "$dev3" "$dev4" ++ lvcreate -aey -l9 -i3 -n $lv2 $vg "$dev2" "$dev3" "$dev4" + check lv_on $vg $lv2 "$dev2" "$dev3" "$dev4" + lvextend -l+2 $vg/$lv1 "$dev2" + check lv_on $vg $lv1 "$dev1" "$dev2" +@@ -57,7 +57,7 @@ prepare_lvs_() { + # original content should be preserved + restore_lvs_() { + vgcfgrestore -f bak-$$ $vg +- vgchange -ay $vg ++ vgchange -aey $vg + } + + lvs_not_changed_() { +@@ -348,7 +348,7 @@ vgremove -ff $vg + pvcreate "${DEVICES[@]}" + pvcreate --metadatacopies 0 "$dev1" "$dev2" + create_vg_ +-lvcreate -l4 -n $lv1 $vg "$dev1" ++lvcreate -aey -l4 -n $lv1 $vg "$dev1" + pvmove $mode "$dev1" + + #COMM "pvmove fails activating mirror, properly restores state before pvmove" +diff --git a/test/shell/pvmove-raid-segtypes.sh b/test/shell/pvmove-raid-segtypes.sh +index be41547..6584b74 100644 +--- a/test/shell/pvmove-raid-segtypes.sh ++++ b/test/shell/pvmove-raid-segtypes.sh +@@ -22,7 +22,7 @@ aux have_raid 1 3 5 || skip + aux prepare_pvs 5 20 + get_devs + +-vgcreate -c n -s 128k "$vg" "${DEVICES[@]}" ++vgcreate -s 128k "$vg" "${DEVICES[@]}" + + for mode in "--atomic" "" + do +@@ -33,8 +33,8 @@ do + # 3) Move only the second LV by name + + # Testing pvmove of RAID1 LV +-lvcreate -l 2 -n ${lv1}_foo $vg "$dev1" +-lvcreate --regionsize 16K -l 2 --type raid1 -m 1 -n $lv1 $vg "$dev1" "$dev2" ++lvcreate -aey -l 2 -n ${lv1}_foo $vg "$dev1" ++lvcreate -aey --regionsize 16K -l 2 --type raid1 -m 1 -n $lv1 $vg "$dev1" "$dev2" + check lv_tree_on $vg ${lv1}_foo "$dev1" + check lv_tree_on $vg $lv1 "$dev1" "$dev2" + aux mkdev_md5sum $vg $lv1 +@@ -49,8 +49,8 @@ check dev_md5sum $vg $lv1 + lvremove -ff $vg + + # Testing pvmove of RAID10 LV +-lvcreate -l 2 -n ${lv1}_foo $vg "$dev1" +-lvcreate -l 4 --type raid10 -i 2 -m 1 -n $lv1 $vg \ ++lvcreate -aey -l 2 -n ${lv1}_foo $vg "$dev1" ++lvcreate -aey -l 4 --type raid10 -i 2 -m 1 -n $lv1 $vg \ + "$dev1" "$dev2" "$dev3" "$dev4" + check lv_tree_on $vg ${lv1}_foo "$dev1" + check lv_tree_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4" +@@ -75,8 +75,8 @@ check dev_md5sum $vg $lv1 + lvremove -ff $vg + + # Testing pvmove of RAID5 LV +-lvcreate -l 2 -n ${lv1}_foo $vg "$dev1" +-lvcreate -l 4 --type raid5 -i 2 -n $lv1 $vg \ ++lvcreate -aey -l 2 -n ${lv1}_foo $vg "$dev1" ++lvcreate -aey -l 4 --type raid5 -i 2 -n $lv1 $vg \ + "$dev1" "$dev2" "$dev3" + check lv_tree_on $vg ${lv1}_foo "$dev1" + check lv_tree_on $vg $lv1 "$dev1" "$dev2" "$dev3" +diff --git a/test/shell/pvmove-thin-segtypes.sh b/test/shell/pvmove-thin-segtypes.sh +index 01d98b4..08685c8 100644 +--- a/test/shell/pvmove-thin-segtypes.sh ++++ b/test/shell/pvmove-thin-segtypes.sh +@@ -24,7 +24,7 @@ aux have_raid 1 3 5 || skip + aux prepare_pvs 5 20 + get_devs + +-vgcreate -c n -s 128k "$vg" "${DEVICES[@]}" ++vgcreate -s 128k "$vg" "${DEVICES[@]}" + + for mode in "--atomic" "" + do +@@ -37,8 +37,8 @@ do + + + # Testing pvmove of thin LV +-lvcreate -l 2 -n ${lv1}_foo $vg "$dev1" +-lvcreate -T $vg/${lv1}_pool -l 4 -V 8 -n $lv1 "$dev1" ++lvcreate -aey -l 2 -n ${lv1}_foo $vg "$dev1" ++lvcreate -aey -T $vg/${lv1}_pool -l 4 -V 8 -n $lv1 "$dev1" + check lv_tree_on $vg ${lv1}_foo "$dev1" + check lv_tree_on $vg $lv1 "$dev1" + aux mkdev_md5sum $vg $lv1 +@@ -53,12 +53,12 @@ check dev_md5sum $vg $lv1 + lvremove -ff $vg + + # Testing pvmove of thin LV on RAID +-lvcreate -l 2 -n ${lv1}_foo $vg "$dev1" +-lvcreate --type raid1 -m 1 -l 4 -n ${lv1}_raid1_pool $vg "$dev1" "$dev2" +-lvcreate --type raid1 -m 1 -L 2 -n ${lv1}_raid1_meta $vg "$dev1" "$dev2" ++lvcreate -aey -l 2 -n ${lv1}_foo $vg "$dev1" ++lvcreate -aey --type raid1 -m 1 -l 4 -n ${lv1}_raid1_pool $vg "$dev1" "$dev2" ++lvcreate -aey --type raid1 -m 1 -L 2 -n ${lv1}_raid1_meta $vg "$dev1" "$dev2" + lvconvert --yes --thinpool $vg/${lv1}_raid1_pool \ + --poolmetadata ${lv1}_raid1_meta +-lvcreate -T $vg/${lv1}_raid1_pool -V 8 -n $lv1 ++lvcreate -aey -T $vg/${lv1}_raid1_pool -V 8 -n $lv1 + check lv_tree_on $vg ${lv1}_foo "$dev1" + check lv_tree_on $vg $lv1 "$dev1" "$dev2" + aux mkdev_md5sum $vg $lv1 +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-default-allow-changes-with-duplicate-pvs.patch b/SOURCES/lvm2-default-allow-changes-with-duplicate-pvs.patch index aa050528..0bf06182 100644 --- a/SOURCES/lvm2-default-allow-changes-with-duplicate-pvs.patch +++ b/SOURCES/lvm2-default-allow-changes-with-duplicate-pvs.patch @@ -3,7 +3,7 @@ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/example.conf.in b/conf/example.conf.in -index b1a2a9c..8e68165 100644 +index 4894d04..48afbd1 100644 --- a/conf/example.conf.in +++ b/conf/example.conf.in @@ -311,7 +311,7 @@ devices { @@ -16,7 +16,7 @@ index b1a2a9c..8e68165 100644 # Configuration section allocation. diff --git a/lib/config/defaults.h b/lib/config/defaults.h -index d988779..985c832 100644 +index d9e19d9..894b979 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -45,7 +45,7 @@ diff --git a/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch b/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch index 949983da..29677e4b 100644 --- a/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch +++ b/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch @@ -4,10 +4,10 @@ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/configure b/configure -index 8253bfc..587b978 100755 +index d04b9d3..4f6e7d7 100755 --- a/configure +++ b/configure -@@ -11951,12 +11951,12 @@ if test -n "$BLKID_CFLAGS"; then +@@ -12322,12 +12322,12 @@ if test -n "$BLKID_CFLAGS"; then pkg_cv_BLKID_CFLAGS="$BLKID_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ @@ -23,7 +23,7 @@ index 8253bfc..587b978 100755 test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes -@@ -11968,12 +11968,12 @@ if test -n "$BLKID_LIBS"; then +@@ -12339,12 +12339,12 @@ if test -n "$BLKID_LIBS"; then pkg_cv_BLKID_LIBS="$BLKID_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ @@ -39,7 +39,7 @@ index 8253bfc..587b978 100755 test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes -@@ -11994,9 +11994,9 @@ else +@@ -12365,9 +12365,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then @@ -51,7 +51,7 @@ index 8253bfc..587b978 100755 fi # Put the nasty error message in config.log where it belongs echo "$BLKID_PKG_ERRORS" >&5 -@@ -12004,7 +12004,7 @@ fi +@@ -12375,7 +12375,7 @@ fi if test "$BLKID_WIPING" = maybe; then BLKID_WIPING=no else @@ -60,7 +60,7 @@ index 8253bfc..587b978 100755 fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -@@ -12012,7 +12012,7 @@ $as_echo "no" >&6; } +@@ -12383,7 +12383,7 @@ $as_echo "no" >&6; } if test "$BLKID_WIPING" = maybe; then BLKID_WIPING=no else @@ -70,29 +70,32 @@ index 8253bfc..587b978 100755 else BLKID_CFLAGS=$pkg_cv_BLKID_CFLAGS diff --git a/configure.in b/configure.in -index 33b5c76..9ed6226 100644 +index d879408..ab8b585 100644 --- a/configure.in +++ b/configure.in -@@ -1302,12 +1302,12 @@ AC_MSG_RESULT($BLKID_WIPING) - +@@ -1312,7 +1312,7 @@ AC_ARG_ENABLE(blkid_wiping, + DEFAULT_USE_BLKID_WIPING=0 if test "$BLKID_WIPING" != no; then pkg_config_init - PKG_CHECK_MODULES(BLKID, blkid >= 2.24, + PKG_CHECK_MODULES(BLKID, blkid >= 2.23, - [test "$BLKID_WIPING" = maybe && BLKID_WIPING=yes], - [if test "$BLKID_WIPING" = maybe; then + [ BLKID_WIPING=yes + BLKID_PC="blkid" + DEFAULT_USE_BLKID_WIPING=1 +@@ -1320,7 +1320,7 @@ if test "$BLKID_WIPING" != no; then + ], [if test "$BLKID_WIPING" = maybe; then BLKID_WIPING=no else - AC_MSG_ERROR([bailing out... blkid library >= 2.24 is required]) + AC_MSG_ERROR([bailing out... blkid library >= 2.23 is required]) fi]) - if test "$BLKID_WIPING" = yes; then - BLKID_PC="blkid" + fi + AC_MSG_CHECKING([whether to enable libblkid detection of signatures when wiping]) diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c -index 0246c09..bae984a 100644 +index 9608146..1e45f9d 100644 --- a/lib/device/dev-type.c +++ b/lib/device/dev-type.c -@@ -703,8 +703,7 @@ static int _wipe_known_signatures_with_blkid(struct device *dev, const char *nam +@@ -713,8 +713,7 @@ static int _wipe_known_signatures_with_blkid(struct device *dev, const char *nam BLKID_SUBLKS_TYPE | BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION | diff --git a/SOURCES/lvm2-rhel7-fix-StartLimitInterval.patch b/SOURCES/lvm2-rhel7-fix-StartLimitInterval.patch new file mode 100644 index 00000000..6245bdbd --- /dev/null +++ b/SOURCES/lvm2-rhel7-fix-StartLimitInterval.patch @@ -0,0 +1,23 @@ + scripts/lvm2_pvscan_systemd_red_hat@.service.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in +index 839bfd1..f0bbd46 100644 +--- a/scripts/lvm2_pvscan_systemd_red_hat@.service.in ++++ b/scripts/lvm2_pvscan_systemd_red_hat@.service.in +@@ -2,7 +2,6 @@ + Description=LVM2 PV scan on device %i + Documentation=man:pvscan(8) + DefaultDependencies=no +-StartLimitInterval=0 + BindsTo=dev-block-%i.device + Requires=lvm2-lvmetad.socket + After=lvm2-lvmetad.socket lvm2-lvmetad.service +@@ -14,3 +13,4 @@ Type=oneshot + RemainAfterExit=yes + ExecStart=@SBINDIR@/lvm pvscan --cache --activate ay %i + ExecStop=@SBINDIR@/lvm pvscan --cache %i ++StartLimitInterval=0 +-- +1.8.3.1 + diff --git a/SOURCES/lvm2-rhel7.patch b/SOURCES/lvm2-rhel7.patch index b029dcef..5efa7559 100644 --- a/SOURCES/lvm2-rhel7.patch +++ b/SOURCES/lvm2-rhel7.patch @@ -1,18 +1,19 @@ VERSION | 2 +- VERSION_DM | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION -index dd4e60e..39d6c15 100644 +index 849efb0..996ced9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ --2.02.166(2) (2016-09-26) -+2.02.166(2)-RHEL7 (2016-11-16) +-2.02.177(2) (2017-12-18) ++2.02.177(2)-RHEL7 (2018-01-22) diff --git a/VERSION_DM b/VERSION_DM -index d53f47a..005fbd4 100644 +index a37f632..1853e94 100644 --- a/VERSION_DM +++ b/VERSION_DM @@ -1 +1 @@ --1.02.135 (2016-09-26) -+1.02.135-RHEL7 (2016-11-16) +-1.02.146 (2017-12-18) ++1.02.146-RHEL7 (2018-01-22) + diff --git a/SOURCES/lvm2-set-default-preferred_names.patch b/SOURCES/lvm2-set-default-preferred_names.patch index 1c446054..a1b30346 100644 --- a/SOURCES/lvm2-set-default-preferred_names.patch +++ b/SOURCES/lvm2-set-default-preferred_names.patch @@ -3,7 +3,7 @@ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/example.conf.in b/conf/example.conf.in -index c0afcb7..ec12918 100644 +index aab274d..4894d04 100644 --- a/conf/example.conf.in +++ b/conf/example.conf.in @@ -106,7 +106,7 @@ devices { @@ -16,10 +16,10 @@ index c0afcb7..ec12918 100644 # Configuration option devices/filter. # Limit the block devices that are used by LVM commands. diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h -index 9017043..c06b6f0 100644 +index 077fb15..65cda08 100644 --- a/lib/config/config_settings.h +++ b/lib/config/config_settings.h -@@ -205,7 +205,7 @@ cfg(devices_external_device_info_source_CFG, "external_device_info_source", devi +@@ -255,7 +255,7 @@ cfg(devices_external_device_info_source_CFG, "external_device_info_source", devi " compiled with udev support.\n" "#\n")