Additional fixes from upcoming v104 (related to udev).

This commit is contained in:
Peter Rajnoha 2013-10-30 14:39:52 +01:00
parent 3ab5e300fb
commit c2c770c44c
2 changed files with 97 additions and 1 deletions

View File

@ -0,0 +1,90 @@
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:

View File

@ -37,7 +37,7 @@
Summary: Userland logical volume management tools
Name: lvm2
Version: 2.02.103
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2
Group: System Environment/Base
URL: http://sources.redhat.com/lvm2
@ -45,6 +45,7 @@ Source0: ftp://sources.redhat.com/pub/lvm2/releases/LVM2.%{version}.tgz
Patch0: lvm2-set-default-preferred_names.patch
Patch1: lvm2-enable-lvmetad-by-default.patch
Patch2: lvm2-2_02_104-additional-fixes-from-v104.patch
Patch3: lvm2-2_02_104-additional-udev-fixes-from-v104.patch
BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
BuildRequires: ncurses-devel
@ -82,6 +83,7 @@ or more physical volumes and creating one or more logical volumes
%patch0 -p1 -b .preferred_names
%patch1 -p1 -b .enable_lvmetad
%patch2 -p1 -b .v104
%patch3 -p1 -b .v104_udev
%build
%define _default_pid_dir /run
@ -579,6 +581,10 @@ the device-mapper event library.
%{_libdir}/pkgconfig/devmapper-event.pc
%changelog
* Wed Oct 30 2013 Peter Rajnoha <prajnoha@redhat.com> - 2.02.103-3
- Fix missing lvmetad scan for PVs found on MD partitions.
- Respect DM_UDEV_DISABLE_OTHER_RULES_FLAG in lvmetad udev rules.
* Fri Oct 25 2013 Peter Rajnoha <prajnoha@redhat.com> - 2.02.103-2
- Add internal flag for temporary LVs to properly direct udev to not interfere.
- Fix endless loop in blkdeactivate <device>... if unable to umount/deactivate.