[lvm2] Avoid exposing temporary devices when initializing thin pool volume.

Peter Rajnoha prajnoha at fedoraproject.org
Mon Jan 27 10:22:54 UTC 2014


commit 987c15a4365e0ad1d26808c38471226f4333a08a
Author: Peter Rajnoha <prajnoha at redhat.com>
Date:   Mon Jan 27 11:22:56 2014 +0100

    Avoid exposing temporary devices when initializing thin pool volume.

 ...evices-when-initializing-thin-pool-volume.patch |   63 ++++++++++++++++++++
 ...move-rules-to-handle-inappropriate-events.patch |   19 +++++-
 lvm2.spec                                          |    3 +
 3 files changed, 83 insertions(+), 2 deletions(-)
---
diff --git a/lvm2-2_02_106-avoid-exposing-temporary-devices-when-initializing-thin-pool-volume.patch b/lvm2-2_02_106-avoid-exposing-temporary-devices-when-initializing-thin-pool-volume.patch
new file mode 100644
index 0000000..634e282
--- /dev/null
+++ b/lvm2-2_02_106-avoid-exposing-temporary-devices-when-initializing-thin-pool-volume.patch
@@ -0,0 +1,63 @@
+commit bb237a04a0ecd44157ee59ce280e8c3bfc456ca1
+Author: Peter Rajnoha <prajnoha at redhat.com>
+Date:   Mon Jan 27 11:19:09 2014 +0100
+
+    thin pool
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index 26b63ae..b755720 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,3 +1,7 @@
++Version 2.02.105 - 
++====================================
++  Avoid exposing temporary devices when initializing thin pool volume.
++
+ Version 2.02.105 - 20th January 2014
+ ====================================
+   Fix thin LV flagging for udev to skip scanning only if the LV is wiped.
+diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
+index 8e36891..cc58941 100644
+--- a/lib/metadata/metadata-exported.h
++++ b/lib/metadata/metadata-exported.h
+@@ -105,9 +105,10 @@
+ #define LV_NOSCAN		UINT64_C(0x0000080000000000)	/* LV - internal use only - the LV
+ 									should not be scanned */
+ #define LV_TEMPORARY		UINT64_C(0x0000100000000000)	/* LV - internal use only - the LV
+-								        is supposed to be created and
+-									removed during single LVM
+-									command execution. */
++									is supposed to be created and
++									removed or reactivated with
++									this flag dropped during single
++									LVM command execution. */
+ 
+ /* Format features flags */
+ #define FMT_SEGMENTS		0x00000001U	/* Arbitrary segment params? */
+diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
+index e12a8ad..3eeb757 100644
+--- a/lib/metadata/thin_manip.c
++++ b/lib/metadata/thin_manip.c
+@@ -484,7 +484,13 @@ int create_pool(struct logical_volume *pool_lv, const struct segment_type *segty
+ 		 *
+ 		 * FIXME: implement lazy clearing when activation is disabled
+ 		 */
+-		/* pool_lv is a new LV so the VG lock protects us */
++		/*
++		 * pool_lv is a new LV so the VG lock protects us
++		 * Pass in LV_TEMPORARY flag, since device is activated purely for wipe
++		 * and later it is either deactivated (in cluster)
++		 * or directly converted to invisible device via suspend/resume
++		*/
++		pool_lv->status |= LV_TEMPORARY;
+ 		if (!activate_lv_local(pool_lv->vg->cmd, pool_lv) ||
+ 		    /* Clear 4KB of metadata device for new thin-pool. */
+ 		    !wipe_lv(pool_lv, (struct wipe_params) { .do_zero = 1 })) {
+@@ -492,6 +498,7 @@ int create_pool(struct logical_volume *pool_lv, const struct segment_type *segty
+ 				  pool_lv->name);
+ 			goto bad;
+ 		}
++		pool_lv->status &= ~LV_TEMPORARY;
+ 	}
+ 
+ 	if (dm_snprintf(name, sizeof(name), "%s_tmeta", pool_lv->name) < 0) {
diff --git a/lvm2-udev-remove-rules-to-handle-inappropriate-events.patch b/lvm2-udev-remove-rules-to-handle-inappropriate-events.patch
index 346a76d..db58463 100644
--- a/lvm2-udev-remove-rules-to-handle-inappropriate-events.patch
+++ b/lvm2-udev-remove-rules-to-handle-inappropriate-events.patch
@@ -1,6 +1,21 @@
- udev/10-dm.rules.in | 6 ------
- 1 file changed, 6 deletions(-)
+commit e624fc8c0e75ea363e27cff824ca5a4521d051a7
+Author: Peter Rajnoha <prajnoha at redhat.com>
+Date:   Mon Jan 27 11:13:02 2014 +0100
 
+    udev - cryptsetup
+
+diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
+index ce302f3..5aa3892 100644
+--- a/WHATS_NEW_DM
++++ b/WHATS_NEW_DM
+@@ -1,3 +1,7 @@
++Version 1.02.85 - 
++===================================
++  Drop cryptsetup rules from 10-dm.rules - cryptsetup >= 1.1.3 sets them.
++
+ Version 1.02.84 - 20th January 2014
+ ===================================
+   Revert activation of activated nodes if a node preload callback fails.
 diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
 index f7088f1..8d7a8ca 100644
 --- a/udev/10-dm.rules.in
diff --git a/lvm2.spec b/lvm2.spec
index 5ae3518..8898e5b 100644
--- a/lvm2.spec
+++ b/lvm2.spec
@@ -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-udev-remove-rules-to-handle-inappropriate-events.patch
+Patch3: lvm2-2_02_106-avoid-exposing-temporary-devices-when-initializing-thin-pool-volume.patch
 
 BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
 BuildRequires: libblkid-devel >= %{util_linux_version}
@@ -83,6 +84,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 .udev_inappropriate_events
+%patch3 -p1 -b .thin_temp_no_expose
 
 %build
 %define _default_pid_dir /run
@@ -591,6 +593,7 @@ the device-mapper event library.
 
 %changelog
 * Mon Jan 27 2014 Peter Rajnoha <prajnoha at redhat.com> - 2.02.105-2
+- Avoid exposing temporary devices when initializing thin pool volume.
 - Remove udev rule for multipath's PATH_FAILED event processing,
   multipath handles that properly in its own udev rules now.
 - Remove duplicate udev rule for cryptsetup temporary devices,


More information about the scm-commits mailing list