main - writecache: don't pvmove device used by writecache
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e7f107c24666c8577f3...
Commit: e7f107c24666c8577f30e530b74f1ce0347e459b
Parent: 247f69f9aafe731ef85268da1e6ce817295b265d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jun 2 11:12:20 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 2 11:12:20 2021 -0500
writecache: don't pvmove device used by writecache
The existing check didn't cover the unusual case where the
cachevol exists on the same device as the origin LV.
---
tools/pvmove.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/pvmove.c b/tools/pvmove.c
index da635a662..bb372f7dc 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -387,6 +387,15 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
return NULL;
}
+ if (lv_is_writecache(lv)) {
+ struct logical_volume *lv_cachevol = first_seg(lv)->writecache;
+ if (lv_is_on_pvs(lv_cachevol, source_pvl)) {
+ log_error("Unable to move device used for writecache cachevol %s.", display_lvname(lv_cachevol));
+ return NULL;
+ }
+
+ }
+
if (lv_is_raid(lv) && lv_raid_has_integrity(lv)) {
log_error("Unable to pvmove device used for raid with integrity.");
return NULL;
2 years, 10 months
main - writecache: fix lv_on_pmem
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=247f69f9aafe731ef85...
Commit: 247f69f9aafe731ef85268da1e6ce817295b265d
Parent: b725b5ea6ecfeef428fd7ffcd6855a38378d761b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jun 2 10:51:12 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 2 10:51:12 2021 -0500
writecache: fix lv_on_pmem
dev_is_pmem on pv->dev requires a pv segment or it could segfault.
---
lib/metadata/metadata.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 110cbaed4..0b284435b 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4412,6 +4412,9 @@ int lv_on_pmem(struct logical_volume *lv)
dm_list_iterate_items(seg, &lv->segments) {
for (s = 0; s < seg->area_count; s++) {
+ if (seg_type(seg, s) != AREA_PV)
+ continue;
+
pv = seg_pv(seg, s);
if (dev_is_pmem(lv->vg->cmd->dev_types, pv->dev)) {
2 years, 10 months