Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2f5ddfbadea5dae6…
Commit: 2f5ddfbadea5dae6b2fc236d4f243bd88d955aa8
Parent: ce7489ed228da22c2a355d0b403a1e5dc6d8c0e0
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Oct 8 13:33:28 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Oct 8 13:43:14 2013 +0200
udev: add support for "NOSCAN" flag
Recognize DM_SUBSYSTEM_UDEV_FLAG0 which for LVM is the "LVM_NOSCAN"
flag that causes the scanning to be skipped (mainly blkid) and
also directs all the foreign rules to be skipped as well.
Important thing here is that the "watch" udev rules is still set
as well as the /dev/disk/by-id content created (which does not
require any scanning to be done). Also, the flag is dropped on
any subsequent event and scanning done...
---
WHATS_NEW | 1 +
udev/11-dm-lvm.rules.in | 15 +++++++++++++++
udev/13-dm-disk.rules.in | 3 ++-
udev/69-dm-lvm-metad.rules.in | 2 ++
4 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 098f348..7450f04 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.104
===================================
+ Recognize new flag to skip udev scanning in udev rules and act appropriately.
Add support for flagging an LV to skip udev scanning during activation.
Improve message when unable to change discards setting on active thin pool.
Run full scan before vgrename operation to avoid any cache name collision.
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index f21d0aa..5032280 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -20,6 +20,21 @@ ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
# Use DM name and split it up into its VG/LV/layer constituents.
IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"
+# DM_SUBSYSTEM_UDEV_FLAG0 is the 'NOSCAN' flag for LVM subsystem.
+# This flag is used to temporarily disable selected rules to prevent any
+# processing or scanning done on the LVM volume before LVM has any chance
+# to zero any stale metadata found within the LV data area. Such stale
+# metadata could cause false claim of the LV device, keeping it open etc.
+#
+# If the NOSCAN flag is present, backup selected existing flags used to
+# disable rules, then set them firmly so those selected rules are surely skipped.
+# Restore these flags once the NOSCAN flag is dropped (which is normally any
+# 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_UDEV_DISABLE_OTHER_RULES_FLAG_OLD}="", ENV{DM_NOSCAN}=""
+
ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
OPTIONS+="event_timeout=180"
diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in
index 1920260..4b64dd6 100644
--- a/udev/13-dm-disk.rules.in
+++ b/udev/13-dm-disk.rules.in
@@ -18,6 +18,7 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
ENV{DM_SUSPENDED}=="1", GOTO="dm_end"
+ENV{DM_NOSCAN}=="1", GOTO="dm_watch"
(BLKID_RULE)
ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100"
@@ -32,7 +33,7 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk
# (like creating a filesystem, changing filesystem label etc.).
#
# But let's use this until we have something better...
-
+LABEL="dm_watch"
OPTIONS+="watch"
LABEL="dm_end"
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index ba43396..3303f4d 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -17,6 +17,8 @@
SUBSYSTEM!="block", GOTO="lvm_end"
(LVM_EXEC_RULE)
+ENV{DM_NOSCAN}=="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.
ENV{.ID_FS_TYPE_NEW}="$env{ID_FS_TYPE}"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6a80d7538110405d…
Commit: 6a80d7538110405dc4f8fc5fe5ae462b32dfe562
Parent: 57d2daff6e6f8758fbfe5758b283fdb6d43e713a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Oct 8 13:33:28 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Oct 8 13:42:23 2013 +0200
udev: add support for "NOSCAN" flag
Recognize DM_SUBSYSTEM_UDEV_FLAG0 which for LVM is the "LVM_NOSCAN"
flag that causes the scanning to be skipped (mainly blkid) and
also directs all the foreign rules to be skipped as well.
Important thing here is that the "watch" udev rules is still set
as well as the /dev/disk/by-id content created (which does not
require any scanning to be done). Also, the flag is dropped on
any subsequent event and scanning done...
---
WHATS_NEW | 1 +
udev/11-dm-lvm.rules.in | 15 +++++++++++++++
udev/13-dm-disk.rules.in | 3 ++-
udev/69-dm-lvm-metad.rules.in | 2 ++
4 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5957924..cd239dd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.104
===================================
+ Recognize new flag to skip udev scanning in udev rules and act appropriately.
Add support for flagging an LV to skip udev scanning during activation.
Improve message when unable to change discards setting on active thin pool.
diff --git a/udev/11-dm-lvm.rules.in b/udev/11-dm-lvm.rules.in
index f21d0aa..5032280 100644
--- a/udev/11-dm-lvm.rules.in
+++ b/udev/11-dm-lvm.rules.in
@@ -20,6 +20,21 @@ ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
# Use DM name and split it up into its VG/LV/layer constituents.
IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"
+# DM_SUBSYSTEM_UDEV_FLAG0 is the 'NOSCAN' flag for LVM subsystem.
+# This flag is used to temporarily disable selected rules to prevent any
+# processing or scanning done on the LVM volume before LVM has any chance
+# to zero any stale metadata found within the LV data area. Such stale
+# metadata could cause false claim of the LV device, keeping it open etc.
+#
+# If the NOSCAN flag is present, backup selected existing flags used to
+# disable rules, then set them firmly so those selected rules are surely skipped.
+# Restore these flags once the NOSCAN flag is dropped (which is normally any
+# 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_UDEV_DISABLE_OTHER_RULES_FLAG_OLD}="", ENV{DM_NOSCAN}=""
+
ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
OPTIONS+="event_timeout=180"
diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in
index 1920260..4b64dd6 100644
--- a/udev/13-dm-disk.rules.in
+++ b/udev/13-dm-disk.rules.in
@@ -18,6 +18,7 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
ENV{DM_SUSPENDED}=="1", GOTO="dm_end"
+ENV{DM_NOSCAN}=="1", GOTO="dm_watch"
(BLKID_RULE)
ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100"
@@ -32,7 +33,7 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk
# (like creating a filesystem, changing filesystem label etc.).
#
# But let's use this until we have something better...
-
+LABEL="dm_watch"
OPTIONS+="watch"
LABEL="dm_end"
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index ba43396..3303f4d 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -17,6 +17,8 @@
SUBSYSTEM!="block", GOTO="lvm_end"
(LVM_EXEC_RULE)
+ENV{DM_NOSCAN}=="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.
ENV{.ID_FS_TYPE_NEW}="$env{ID_FS_TYPE}"
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=273373bf53b34817…
Commit: 273373bf53b34817481ef2c395c84a7cdf4f1998
Parent: 7edf61186b6afdcc7ab8b44072818995cef3702b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 8 13:30:21 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 8 13:42:10 2013 +0200
tests: lvconvert more thin extorg conversions
Add test for conversion of pool and thin lv at the same time.
---
test/shell/lvconvert-thin-external.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-thin-external.sh b/test/shell/lvconvert-thin-external.sh
index a700b37..d9d4d19 100644
--- a/test/shell/lvconvert-thin-external.sh
+++ b/test/shell/lvconvert-thin-external.sh
@@ -144,5 +144,13 @@ lvs -a -o+origin_size,seg_size,segtype $vg
lvremove -f $vg/extorg2
# Only pool is left
check vg_field $vg lv_count 1
+lvremove -ff $vg
+
+# Test conversion to the pool and thin external at the same time (rhbz #1003461)
+lvcreate -l50 -n pool $vg
+lvcreate -l100 -n thin $vg
+lvconvert --thin --thinpool $vg/pool $vg/thin --originname thin-origin
+check lv_field $vg/thin segtype thin
+check lv_field $vg/thin-origin segtype linear
vgremove -ff $vg
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=92bafade6051f95d…
Commit: 92bafade6051f95d49b35a53c77d0fc25a1fb7ec
Parent: 30746f31dd1db63e0c83e6f8c7ae65dab3f69a4b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 8 13:24:22 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 8 13:41:06 2013 +0200
thin: fix lvconvert in external origin conversion
Patch 562ad293fd52b8f3096b28bcac20e32aa1e8c1b0 introduced code regression
when LV was converted to a thin LV with external origin and at the same time,
conversion of LV to a thin pool has been requested.
(RHBZ: #997704)
data_lv needs to be assigned after test for external conversion find pool.
---
WHATS_NEW | 1 +
tools/lvconvert.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 93a156a..cd9f00a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -2,6 +2,7 @@ Version 2.02.104
===================================
Improve message when unable to change discards setting on active thin pool.
Run full scan before vgrename operation to avoid any cache name collision.
+ Fix lvconvert when converting to a thin pool and thin LV at once.
Version 2.02.103 - 4th October 2013
===================================
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 49881fa..1970ca3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2266,7 +2266,7 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
int r = 0;
const char *old_name;
struct lv_segment *seg;
- struct logical_volume *data_lv = pool_lv;
+ struct logical_volume *data_lv;
struct logical_volume *metadata_lv;
struct logical_volume *pool_metadata_lv;
struct logical_volume *external_lv = NULL;
@@ -2304,6 +2304,7 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
}
}
+ data_lv = pool_lv;
if (lv_is_thin_type(pool_lv) && !lp->pool_metadata_lv_name) {
log_error("Can't use thin logical volume %s/%s for thin pool data.",
pool_lv->vg->name, pool_lv->name);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=30746f31dd1db63e…
Commit: 30746f31dd1db63e0c83e6f8c7ae65dab3f69a4b
Parent: 4806f38d703c2d7cd01e0adc49505ccb7d010a17
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 8 11:15:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 8 13:39:11 2013 +0200
vgrename: run fullscan
For vgrename run full scan so the command is able to properly
detect name collision.
---
WHATS_NEW | 1 +
tools/vgrename.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5b35890..93a156a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,6 +1,7 @@
Version 2.02.104
===================================
Improve message when unable to change discards setting on active thin pool.
+ Run full scan before vgrename operation to avoid any cache name collision.
Version 2.02.103 - 4th October 2013
===================================
diff --git a/tools/vgrename.c b/tools/vgrename.c
index 154a6f3..b5e778f 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -83,6 +83,8 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
if (!lvmetad_vg_list_to_lvmcache(cmd))
stack;
+ lvmcache_label_scan(cmd, 2);
+
/* Avoid duplicates */
if (!(vgids = get_vgids(cmd, 0)) || dm_list_empty(vgids)) {
log_error("No complete volume groups found");