Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ff3ffe30e4c3ceac4abbd…
Commit: ff3ffe30e4c3ceac4abbdece7068bf7299a8ab39
Parent: 9068de011d900df46a87d6cb0de08160136bde66
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Apr 20 11:55:22 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 20 12:07:36 2018 +0200
activation: add generic rule for visibility change
Whenever we make visible LV out of previously invisible one,
reload it's table - the is mandator for proper udev rule
processing as well as ensure content of dm table is correct.
TODO: this new generic rule probably make extra raid rules unnecessary.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 82b47c5..15908ca 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Enhnace preloading tree creating.
Fix regression on acceptance of any LV on lvconvert.
Restore usability of thin LV to be again external origin for another thin.
Keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 777fc21..6611e99 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2108,6 +2108,12 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
return_0;
}
+ if (!lv_is_visible(lv) && (lv_pre = find_lv(detached->lv_pre->vg, lv->name)) &&
+ lv_is_visible(lv_pre)) {
+ if (!_lv_preload(lv_pre, detached->laopts, detached->flush_required))
+ return_0;
+ }
+
/* FIXME: condition here should be far more limiting to really
* detect detached LVs */
if ((lv_pre = find_lv(detached->lv_pre->vg, lv->name))) {
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9068de011d900df46a87d…
Commit: 9068de011d900df46a87d6cb0de08160136bde66
Parent: a7d077b89b71fb2ddd9e87526b5675aadf38dfba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 18 12:57:17 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 20 12:06:51 2018 +0200
lvconvert: drop limitation for converting lv
Fixing regresion on argument acceptance where any lv can be passed
with paramaterless lvconvert which is meant to figure out needed
operation - i.e. wait for mirror synchronization.
User has no other 'effective' method to wait for mirror getting in-sync.
---
WHATS_NEW | 1 +
tools/command-lines.in | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 192c5c2..82b47c5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Fix regression on acceptance of any LV on lvconvert.
Restore usability of thin LV to be again external origin for another thin.
Keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload.
Write systemd and non-systemd rule in 69-dm-lvm-metad.rules, GOTO active one.
diff --git a/tools/command-lines.in b/tools/command-lines.in
index e555e95..9d407d0 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -701,8 +701,8 @@ RULE: all and lv_is_converting
lvconvert LV_mirror_raid
OO: OO_LVCONVERT
ID: lvconvert_start_poll
-DESC: Poll LV to continue conversion (also see --startpoll).
-RULE: all and lv_is_converting
+DESC: Poll LV to continue conversion (also see --startpoll)
+DESC: or waits till conversion/mirror syncing is finished
FLAGS: SECONDARY_SYNTAX
---
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a7d077b89b71fb2ddd9e8…
Commit: a7d077b89b71fb2ddd9e87526b5675aadf38dfba
Parent: ace97c9f9cdc6f0bfd33ae465404169a33953c1e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 29 18:55:09 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Apr 20 12:06:03 2018 +0200
thin: restore usability of thin for external origin
With command definition it's been lost support for thin LV being
an external origin for another thinLV.
---
WHATS_NEW | 1 +
tools/command-lines.in | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9f078b5..192c5c2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Restore usability of thin LV to be again external origin for another thin.
Keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload.
Write systemd and non-systemd rule in 69-dm-lvm-metad.rules, GOTO active one.
Add test for activation/volume_list (Sub)LV remnants.
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 2a6882e..e555e95 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -421,7 +421,7 @@ FLAGS: SECONDARY_SYNTAX
# lvconvert utilities for creating/maintaining thin and cache objects.
# Create a new command set for these and migrate them out of lvconvert?
-lvconvert --type thin --thinpool LV LV_linear_striped_raid_cache
+lvconvert --type thin --thinpool LV LV_linear_striped_raid_cache_thin
OO: --thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
ID: lvconvert_to_thin_with_external
DESC: Convert LV to a thin LV, using the original LV as an external origin.
@@ -430,7 +430,7 @@ RULE: all not lv_is_locked
RULE: --poolmetadata not --readahead --stripesize --stripes_long
# alternate form of lvconvert --type thin
-lvconvert --thin --thinpool LV LV_linear_striped_raid_cache
+lvconvert --thin --thinpool LV LV_linear_striped_raid_cache_thin
OO: --type thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
ID: lvconvert_to_thin_with_external
DESC: Convert LV to a thin LV, using the original LV as an external origin
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7a7b8a7778aace88c967e…
Commit: 7a7b8a7778aace88c967ee8285485c494ce1f3f8
Parent: 99bfbbf229acf4548f1ffc06625f464dc0ae4ca4
Author: Martin Wilck <mwilck(a)suse.com>
AuthorDate: Tue Apr 17 11:38:12 2018 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Apr 17 11:38:12 2018 +0200
udev: keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload
The current logic that avoids setting SYSTEMD_ALIAS and SYSTEMD_WANTS
on "change" events is flawed in the default "systemd background job"
configuration. For systemd, it's important that device properties don't
change spuriously.
If an "add" event starts lvm2-pvscan@.service for a device, and a
"change" event follows, removing SYSTEMD_ALIAS and SYSTEMD_WANTS from the
udev db, information about unit dependencies between the device and the
pvscan service can be lost in systemd, in particular if the daemon
configuration is reloaded.
Steps to reproduce problem:
- create a device with an LVM PV
- remove device
- add device (generates "add" and "change" uevents for the device)
(at this point SYSTEMD_ALIAS and SYSTEMD_WANTS are clear in udev db)
- systemctl daemon-reload
(systemd reloads udev db)
- vgchange -a n
- remove device
=> the lvm2-pvscan@.service for the device is still active although the
device is gone.
- add device again
=> the PV is not detected, because systemd sees the lvm2-pvscan@.service
as active and thus doesn't restart it.
The original purpose of this logic was to avoid volumes being scanned
over and over again. With systemd background jobs, that isn't necessary,
because systemd will not restart the job as long as it's active.
Signed-off-by: Martin Wilck <mwilck(a)suse.com>
---
WHATS_NEW | 1 +
udev/69-dm-lvm-metad.rules.in | 54 ++++++++++++++++++++++++++++++----------
udev/Makefile.in | 4 ++-
3 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e0e9c51..9f078b5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload.
Write systemd and non-systemd rule in 69-dm-lvm-metad.rules, GOTO active one.
Add test for activation/volume_list (Sub)LV remnants.
Disallow usage of cache format 2 with mq cache policy.
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index 38687f4..2ff8ddc 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -68,35 +68,46 @@ ACTION=="change", ENV{LVM_LOOP_PV_ACTIVATED}!="1", TEST=="loop/backing_file", EN
ENV{LVM_LOOP_PV_ACTIVATED}!="1", ENV{SYSTEMD_READY}="0"
GOTO="lvm_end"
-# If the PV is not a special device listed above, scan only after device addition (ADD event)
+# If the PV is not a special device listed above, scan only if necessary.
+# For "direct_pvscan" mode (see below), this means run rules only an ADD events.
+# For "systemd_background" mode, systemd takes care of this by activating
+# the lvm2-pvscan@.service only once.
LABEL="next"
-ACTION!="add", GOTO="lvm_end"
+ACTION!="(PVSCAN_ACTION)", GOTO="lvm_end"
LABEL="lvm_scan"
-# The table below summarises the situations in which we reach the LABEL="lvm_scan".
+ENV{SYSTEMD_READY}="1"
+
+# The method for invoking pvscan is selected at build time with the option
+# --(enable|disable)-udev-systemd-background-jobs to "configure".
+# On modern distributions with recent systemd, it's "systemd_background";
+# on others, "direct_pvscan".
+GOTO="(PVSCAN_RULE)"
+
+LABEL="systemd_background"
+
+# The table below summarises the situations in which we reach the LABEL="lvm_scan"
+# in the "systemd_background" case.
# Marked by X, X* means only if the special dev is properly set up.
# The artificial ADD is supported for coldplugging. We avoid running the pvscan
# on artificial CHANGE so there's no unexpected autoactivation when WATCH rule fires.
# N.B. MD and loop never actually reaches lvm_scan on REMOVE as the PV label is gone
# within a CHANGE event (these are caught by the "LVM_PV_GONE" rule at the beginning).
#
+# In this case, we simply set up the dependency between the device and the pvscan
+# job using SYSTEMD_ALIAS (which sets up a simplified device identifier that
+# allows using "BindsTo" in the sytemd unit file) and SYSTEMD_WANTS (which tells
+# systemd to start the pvscan job once the device is ready).
+# We need to set these variables for both "add" and "change" events, otherwise
+# systemd may loose information about the device/unit dependencies.
+#
# | real ADD | real CHANGE | artificial ADD | artificial CHANGE | REMOVE
# =============================================================================
# DM | | X | X* | | X
# MD | | X | X* | |
# loop | | X | X* | |
-# other | X | | X | | X
-ENV{SYSTEMD_READY}="1"
-
-# The method for invoking pvscan is selected at build time with the option
-# --(enable|disable)-udev-systemd-background-jobs to "configure".
-# On modern distributions with recent systemd, it's "systemd_background";
-# on others, "direct_pvscan".
-GOTO="(PVSCAN_RULE)"
-
-LABEL="systemd_background"
-
+# other | X | X | X | | X
ACTION!="remove", ENV{LVM_PV_GONE}=="1", RUN+="(BINDIR)/systemd-run (LVM_EXEC)/lvm pvscan --cache $major:$minor", GOTO="lvm_end"
ENV{SYSTEMD_ALIAS}="/dev/block/$major:$minor"
ENV{ID_MODEL}="LVM PV $env{ID_FS_UUID_ENC} on /dev/$name"
@@ -105,6 +116,21 @@ GOTO="lvm_end"
LABEL="direct_pvscan"
+# The table below summarises the situations in which we reach the LABEL="lvm_scan"
+# for the "direct_pvscan" case.
+# Marked by X, X* means only if the special dev is properly set up.
+# The artificial ADD is supported for coldplugging. We avoid running the pvscan
+# on artificial CHANGE so there's no unexpected autoactivation when WATCH rule fires.
+#
+# In this case, we need to make sure that pvscan is not invoked spuriously, therefore
+# we invoke it only for "add" events for "other" devices.
+#
+# | real ADD | real CHANGE | artificial ADD | artificial CHANGE | REMOVE
+# =============================================================================
+# DM | | X | X* | | X
+# MD | | X | X* | |
+# loop | | X | X* | |
+# other | X | | X | | X
RUN+="(LVM_EXEC)/lvm pvscan --background --cache --activate ay --major $major --minor $minor", ENV{LVM_SCANNED}="1"
LABEL="lvm_end"
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 9b2e2c3..6f57d46 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -48,12 +48,14 @@ endif
ifeq ("@UDEV_SYSTEMD_BACKGROUND_JOBS@", "yes")
PVSCAN_RULE=systemd_background
+PVSCAN_ACTION=add|change
else
PVSCAN_RULE=direct_pvscan
+PVSCAN_ACTION=add
endif
%.rules: $(srcdir)/%.rules.in
- $(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(BINDIR)+$(BINDIR)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(PVSCAN_RULE)+$(PVSCAN_RULE)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@
+ $(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(BINDIR)+$(BINDIR)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(PVSCAN_RULE)+$(PVSCAN_RULE)+;s+(PVSCAN_ACTION)+$(PVSCAN_ACTION)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@
%_install: %.rules
$(INSTALL_DATA) -D $< $(udevdir)/$(<F)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc286910ecb9a1a5962b9…
Commit: bc286910ecb9a1a5962b93618852d1ed4a7ca7dc
Parent: 3a48fb47b771c3f4db4222f0fdaf5eb462803ac5
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Apr 6 15:25:46 2018 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Apr 6 15:26:38 2018 +0200
test: add lvcreate-raid-volume_list
Test that no (Sub)LV remnants persist if the volume group is
not listed in configuration variable activation/volume_list,
hence not activatable thus causing initialization of rmeta
SubLVs to fail.
Related: rhbz1161347
---
WHATS_NEW | 1 +
test/shell/lvcreate-raid-volume_list.sh | 42 +++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3750341..e5d34dc 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Add test for activation/volume_list (Sub)LV remnants.
Disallow usage of cache format 2 with mq cache policy.
Again accept striped LV as COW LV with lvconvert -s (2.02.169).
Fix raid target version testing for supported features.
diff --git a/test/shell/lvcreate-raid-volume_list.sh b/test/shell/lvcreate-raid-volume_list.sh
new file mode 100644
index 0000000..a47b961
--- /dev/null
+++ b/test/shell/lvcreate-raid-volume_list.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+# bz1161347 - When raid creation is aborted, left-over devices appear
+
+. lib/inittest
+
+########################################################
+# MAIN
+########################################################
+aux have_raid 1 3 0 || skip
+
+aux prepare_pvs 2 # 2 devices for RAID1
+get_devs
+vgcreate -s 512k "$vg" "${DEVICES[@]}"
+
+aux lvmconf "activation/volume_list = [ \"vg_not_exist\" ]"
+
+##########################################################
+# Create 2-way raid1 which fails due to $vg not listed on
+# activation/volume_list. Check for any (Sub)LV remnants.
+##########################################################
+not lvcreate --yes --type raid1 -l 2 -n $lv $vg
+check lv_not_exists $vg/${lv}_rmeta_0
+check lv_not_exists $vg/${lv}_rmeta_1
+check lv_not_exists $vg/${lv}_rimage_0
+check lv_not_exists $vg/${lv}_rimage_1
+check lv_not_exists $vg/$lv
+
+vgremove -ff $vg