lvm2/lvm2-2_02_104-additional-udev-fixes-from-v104.patch

91 lines
3.8 KiB
Diff

WHATS_NEW | 2 ++
tools/lvconvert.c | 20 ++++++++++++--------
udev/11-dm-lvm.rules.in | 2 +-
udev/69-dm-lvm-metad.rules.in | 3 ++-
4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 49f37a4..fc19a85 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.104
===================================
+ Fix missing lvmetad scan for PVs found on MD partitions.
+ Respect DM_UDEV_DISABLE_OTHER_RULES_FLAG in lvmetad udev rules.
Add internal flag for temporary LVs to properly direct udev to not interfere.
Fix endless loop in blkdeactivate <device>... if unable to umount/deactivate.
Add dev-block-<major>:<minor>.device systemd alias for complete PV tracking.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index a6c1187..92a2022 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2435,14 +2435,8 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
goto mda_write;
}
- metadata_lv->status |= LV_NOSCAN;
- if (!lv_is_active(metadata_lv) &&
- !activate_lv_local(cmd, metadata_lv)) {
- log_error("Aborting. Failed to activate thin metadata lv.");
- return 0;
- }
- if (!set_lv(cmd, metadata_lv, UINT64_C(0), 0)) {
- log_error("Aborting. Failed to wipe thin metadata lv.");
+ if (!deactivate_lv(cmd, metadata_lv)) {
+ log_error("Aborting. Failed to deactivate thin metadata lv.");
return 0;
}
@@ -2462,6 +2456,16 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
&lp->thin_chunk_size_calc_policy, &lp->chunk_size,
&lp->discards, &lp->poolmetadata_size, &lp->zero))
return_0;
+
+ metadata_lv->status |= LV_TEMPORARY;
+ if (!activate_lv_local(cmd, metadata_lv)) {
+ log_error("Aborting. Failed to activate thin metadata lv.");
+ return 0;
+ }
+ if (!set_lv(cmd, metadata_lv, UINT64_C(0), 0)) {
+ log_error("Aborting. Failed to wipe thin metadata lv.");
+ return 0;
+ }
}
if (!deactivate_lv(cmd, metadata_lv)) {
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index 5032280..9ca0375 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -32,7 +32,7 @@ IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows
# uevent that follows for this LV, even an artificially generated one).
ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{DM_NOSCAN}="1", ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
ENV{DM_SUBSYSTEM_UDEV_FLAG0}!="1", IMPORT{db}="DM_NOSCAN", IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD"
-ENV{DM_SUBSYSTEM_UDEV_FLAG0}!="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}", \
+ENV{DM_SUBSYSTEM_UDEV_FLAG0}!="1", ENV{DM_NOSCAN}=="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}", \
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG_OLD}="", ENV{DM_NOSCAN}=""
ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index 3e303b1..5b15b6f 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -17,7 +17,7 @@
SUBSYSTEM!="block", GOTO="lvm_end"
(LVM_EXEC_RULE)
-ENV{DM_NOSCAN}=="1", GOTO="lvm_end"
+ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="lvm_end"
# If the PV label got lost, inform lvmetad immediately.
# Detect the lost PV label by comparing previous ID_FS_TYPE value with current one.
@@ -51,6 +51,7 @@ KERNEL!="md[0-9]*", GOTO="next"
IMPORT{db}="LVM_MD_PV_ACTIVATED"
ACTION=="add", ENV{LVM_MD_PV_ACTIVATED}=="1", GOTO="lvm_scan"
ACTION=="change", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1", GOTO="lvm_scan"
+ACTION=="add", KERNEL=="md[0-9]*p[0-9]*", GOTO="lvm_scan"
GOTO="lvm_end"
# Loop device: