master - tests: check preserved exclusivness of snapshot merge
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8ebd45fde759c438e85...
Commit: 8ebd45fde759c438e854d6b4f02f0e9803094fea
Parent: 8c7ec44bf0fb23e2c5e426c5d07b02e3d25f5b59
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 15 13:29:14 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:45:48 2018 +0100
tests: check preserved exclusivness of snapshot merge
Detect if origin remains exclusively activated after merging.
---
test/shell/snapshot-merge.sh | 4 ++++
test/shell/thin-merge.sh | 9 +++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
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
6 years, 3 months
master - tests: properly test with clustered VG
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8c7ec44bf0fb23e2c5e...
Commit: 8c7ec44bf0fb23e2c5e426c5d07b02e3d25f5b59
Parent: 3aedaa7f2aa3c8622538e2758bf905ceb156db4a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 11 16:05:44 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:45:48 2018 +0100
tests: properly test with clustered VG
Testing in cluster makes sense only with clustered VG.
---
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
6 years, 3 months
master - cleanup: drop unused code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3aedaa7f2aa3c862253...
Commit: 3aedaa7f2aa3c8622538e2758bf905ceb156db4a
Parent: 38b81e6537a8dc497a4bc616a1f51632b43137ca
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 11 16:11:21 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:45:48 2018 +0100
cleanup: drop unused code
---
tools/pvmove.c | 9 ---------
1 files changed, 0 insertions(+), 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;
6 years, 3 months
master - cleanup: enhance messages
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=38b81e6537a8dc497a4...
Commit: 38b81e6537a8dc497a4bc616a1f51632b43137ca
Parent: a8bcdef4fd172b705572e3c0b277e6941be642f4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 11 10:46:04 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:45:48 2018 +0100
cleanup: enhance messages
Add extra info about failing local exlusive activation
(as in cluster the LV can be active on some other nodes).
---
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;
}
6 years, 3 months
master - activation: guard exclusive activation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a8bcdef4fd172b70557...
Commit: a8bcdef4fd172b705572e3c0b277e6941be642f4
Parent: f41935909fec9eb8d64bc04530be2f38866f0b8e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 15 16:26:00 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:45:47 2018 +0100
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.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 00334b5..bc73cd7 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.
Suppress some repeated reads of the same disk data at the device layer.
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;
6 years, 3 months
master - dmeventd: add check for result code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f41935909fec9eb8d64...
Commit: f41935909fec9eb8d64bc04530be2f38866f0b8e
Parent: 02621cffb0d5ff72adb8770e26c1b4adb95bd0d9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jan 5 21:08:24 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:44:33 2018 +0100
dmeventd: add check for result code
Check result from pthread_kill.
---
daemons/dmeventd/dmeventd.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
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();
}
6 years, 3 months
master - pvmove: drop misleading pvmove restriction for cluster
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=02621cffb0d5ff72adb...
Commit: 02621cffb0d5ff72adb8770e26c1b4adb95bd0d9
Parent: 5a961d3411c8c11312d2998378277efc8988fc7f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 11 16:15:16 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:44:33 2018 +0100
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.
---
tools/pvmove.c | 10 ----------
1 files changed, 0 insertions(+), 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;
6 years, 3 months
master - pvmove: better check for exclusive LV
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5a961d3411c8c11312d...
Commit: 5a961d3411c8c11312d2998378277efc8988fc7f
Parent: 7c6fb63041cd5c1fb899cc468d0a5cf23a01abbe
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jan 12 15:59:07 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:44:33 2018 +0100
pvmove: better check for exclusive LV
---
tools/pvmove.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
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);
6 years, 3 months
master - lvconvert: use excl activation for conversion
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e86910b052ef50dfdaa...
Commit: e86910b052ef50dfdaad104d17bda679f698e31f
Parent: c26458339ee3b3bdd0e49127e887c0417cbc1438
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jan 12 13:34:13 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:43:34 2018 +0100
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.
---
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 489c315..efaa5b3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Preserve exclusive activation during thin snaphost merge.
Suppress some repeated reads of the same disk data at the device layer.
Avoid exceeding array bounds in allocation tag processing.
Refactor metadata reading code to use callback functions.
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;
}
6 years, 3 months
master - pvmove: fix _remove_sibling_pvs_from_trim_list
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7c6fb63041cd5c1fb89...
Commit: 7c6fb63041cd5c1fb899cc468d0a5cf23a01abbe
Parent: e86910b052ef50dfdaad104d17bda679f698e31f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jan 11 13:21:08 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 17 14:44:31 2018 +0100
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.
---
WHATS_NEW | 1 +
tools/pvmove.c | 16 +++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index efaa5b3..00334b5 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.
Suppress some repeated reads of the same disk data at the device layer.
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;
}
6 years, 3 months