Date: Friday, April 11, 2014 @ 23:59:45 Author: thomas Revision: 210210
upgpkg: lvm2 2.02.106-1 Modified: lvm2/trunk/PKGBUILD Deleted: lvm2/trunk/0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch lvm2/trunk/0002-snapshot-zero-cow-header-for-read-only-snapshot.patch lvm2/trunk/lvm2-2.02.105-readline-6.3.patch -----------------------------------------------------------------+ 0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch | 199 ---------- 0002-snapshot-zero-cow-header-for-read-only-snapshot.patch | 74 --- PKGBUILD | 20 - lvm2-2.02.105-readline-6.3.patch | 48 -- 4 files changed, 5 insertions(+), 336 deletions(-) Deleted: 0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch =================================================================== --- 0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch 2014-04-11 21:45:37 UTC (rev 210209) +++ 0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch 2014-04-11 21:59:45 UTC (rev 210210) @@ -1,199 +0,0 @@ -From a29d36c9ac41aa3aa4818c277c9c0e20cbd6175b Mon Sep 17 00:00:00 2001 -From: Peter Rajnoha <[email protected]> -Date: Mon, 10 Feb 2014 13:28:13 +0100 -Subject: [PATCH 1/2] wiping: wipe DM_snapshot_cow signature without prompt in - newly created LVs -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The libblkid can detect DM_snapshot_cow signature and when creating -new LVs with blkid wiping used (allocation/use_blkid_wiping=1 lvm.conf -setting and --wipe y used at the same time - which it is by default). - -Do not issue any prompts about this signature when new LV is created -and just wipe it right away without asking questions. Still keep the -log in verbose mode though. - -Conflicts: - WHATS_NEW - lib/device/dev-type.c - -[backported to 2.02.105 by Thomas Bächler, [email protected]] ---- - WHATS_NEW | 2 ++ - lib/device/dev-type.c | 47 ++++++++++++++++++++++++++++++++--------------- - lib/device/dev-type.h | 6 +++++- - lib/metadata/lv_manip.c | 4 +++- - lib/metadata/metadata.c | 4 +++- - 5 files changed, 45 insertions(+), 18 deletions(-) - -diff --git a/WHATS_NEW b/WHATS_NEW -index 26b63ae..d2a3482 100644 ---- a/WHATS_NEW -+++ b/WHATS_NEW -@@ -1,3 +1,5 @@ -+ Wipe DM_snapshot_cow signature without prompt in new LVs with blkid wiping. -+ - 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/device/dev-type.c b/lib/device/dev-type.c -index 78b093c..d2ff71e 100644 ---- a/lib/device/dev-type.c -+++ b/lib/device/dev-type.c -@@ -449,17 +449,25 @@ out: - - #ifdef BLKID_WIPING_SUPPORT - -+static inline int _type_in_flag_list(const char *type, uint32_t flag_list) -+{ -+ return (((flag_list & TYPE_LVM2_MEMBER) && !strcmp(type, "LVM2_member")) || -+ ((flag_list & TYPE_LVM1_MEMBER) && !strcmp(type, "LVM1_member")) || -+ ((flag_list & TYPE_DM_SNAPSHOT_COW) && !strcmp(type, "DM_snapshot_cow"))); -+} -+ - static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name, -- int exclude_lvm_member, int yes, force_t force) -+ uint32_t types_to_exclude, uint32_t types_no_prompt, -+ int yes, force_t force) - { -+ static const char* msg_wiping = "Wiping %s signature on %s."; - const char *offset = NULL, *type = NULL, *magic = NULL, - *usage = NULL, *label = NULL, *uuid = NULL; - loff_t offset_value; - size_t len; - - if (!blkid_probe_lookup_value(probe, "TYPE", &type, NULL)) { -- if (exclude_lvm_member && -- (!strcmp(type, "LVM1_member") || !strcmp(type, "LVM2_member"))) -+ if (_type_in_flag_list(type, types_to_exclude)) - return 1; - if (!blkid_probe_lookup_value(probe, "SBMAGIC_OFFSET", &offset, NULL) && - blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) -@@ -483,12 +491,15 @@ static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name, - "UUID=\"%s\" TYPE=\"%s\" USAGE=\"%s\"", - name, offset, label, uuid, type, usage); - -- if (!yes && (force == PROMPT) && -- yes_no_prompt("WARNING: %s signature detected on %s at offset %s. " -- "Wipe it? [y/n] ", type, name, offset) != 'y') -- return_0; -+ if (!_type_in_flag_list(type, types_no_prompt)) { -+ if (!yes && (force == PROMPT) && -+ yes_no_prompt("WARNING: %s signature detected on %s at offset %s. " -+ "Wipe it? [y/n] ", type, name, offset) != 'y') -+ return_0; -+ log_print_unless_silent(msg_wiping, type, name); -+ } else -+ log_verbose(msg_wiping, type, name); - -- log_print_unless_silent("Wiping %s signature on %s.", type, name); - if (!dev_set(dev, offset_value, len, 0)) { - log_error("Failed to wipe %s signature on %s.", type, name); - return 0; -@@ -498,7 +509,8 @@ static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name, - } - - static int _wipe_known_signatures_with_blkid(struct device *dev, const char *name, -- int exclude_lvm_member, -+ uint32_t types_to_exclude, -+ uint32_t types_no_prompt, - int yes, force_t force) - { - blkid_probe probe = NULL; -@@ -526,7 +538,7 @@ static int _wipe_known_signatures_with_blkid(struct device *dev, const char *nam - - while (!blkid_do_probe(probe)) { - found++; -- if (_blkid_wipe(probe, dev, name, exclude_lvm_member, yes, force)) -+ if (_blkid_wipe(probe, dev, name, types_to_exclude, types_no_prompt, yes, force)) - wiped++; - } - -@@ -580,7 +592,8 @@ static int _wipe_signature(struct device *dev, const char *type, const char *nam - } - - static int _wipe_known_signatures_with_lvm(struct device *dev, const char *name, -- int exclude_lvm_member, -+ uint32_t types_to_exclude __attribute__((unused)), -+ uint32_t types_no_prompt __attribute__((unused)), - int yes, force_t force) - { - if (!_wipe_signature(dev, "software RAID md superblock", name, 4, yes, force, dev_is_md) || -@@ -592,16 +605,20 @@ static int _wipe_known_signatures_with_lvm(struct device *dev, const char *name, - } - - int wipe_known_signatures(struct cmd_context *cmd, struct device *dev, -- const char *name, int exclude_lvm_member, -- int yes, force_t force) -+ const char *name, uint32_t types_to_exclude, -+ uint32_t types_no_prompt, int yes, force_t force) - { - #ifdef BLKID_WIPING_SUPPORT - if (find_config_tree_bool(cmd, allocation_use_blkid_wiping_CFG, NULL)) - return _wipe_known_signatures_with_blkid(dev, name, -- exclude_lvm_member, yes, force); -+ types_to_exclude, -+ types_no_prompt, -+ yes, force); - #endif - return _wipe_known_signatures_with_lvm(dev, name, -- exclude_lvm_member, yes, force); -+ types_to_exclude, -+ types_no_prompt, -+ yes, force); - } - - #ifdef __linux__ -diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h -index 284280e..b1520ee 100644 ---- a/lib/device/dev-type.h -+++ b/lib/device/dev-type.h -@@ -60,8 +60,12 @@ int dev_is_swap(struct device *dev, uint64_t *signature); - int dev_is_luks(struct device *dev, uint64_t *signature); - - /* Signature wiping. */ -+#define TYPE_LVM1_MEMBER 0x001 -+#define TYPE_LVM2_MEMBER 0x002 -+#define TYPE_DM_SNAPSHOT_COW 0x004 - int wipe_known_signatures(struct cmd_context *cmd, struct device *dev, const char *name, -- int exclude_lvm_member, int yes, force_t force); -+ uint32_t types_to_exclude, uint32_t types_no_prompt, -+ int yes, force_t force); - - /* Type-specific device properties */ - unsigned long dev_md_stripe_width(struct dev_types *dt, struct device *dev); -diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c -index f45c89f..66f3bd7 100644 ---- a/lib/metadata/lv_manip.c -+++ b/lib/metadata/lv_manip.c -@@ -5448,7 +5448,9 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp) - if (wp.do_wipe_signatures) { - log_verbose("Wiping known signatures on logical volume \"%s/%s\"", - lv->vg->name, lv->name); -- if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0, wp.yes, wp.force)) -+ if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0, -+ TYPE_DM_SNAPSHOT_COW, -+ wp.yes, wp.force)) - stack; - } - -diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c -index 4d4778b..e4e1771 100644 ---- a/lib/metadata/metadata.c -+++ b/lib/metadata/metadata.c -@@ -1372,7 +1372,9 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name, - goto bad; - } - -- if (!wipe_known_signatures(cmd, dev, name, 1, pp->yes, pp->force)) { -+ if (!wipe_known_signatures(cmd, dev, name, -+ TYPE_LVM1_MEMBER | TYPE_LVM2_MEMBER, -+ 0, pp->yes, pp->force)) { - log_error("Aborting pvcreate on %s.", name); - goto bad; - } --- -1.9.0 - Deleted: 0002-snapshot-zero-cow-header-for-read-only-snapshot.patch =================================================================== --- 0002-snapshot-zero-cow-header-for-read-only-snapshot.patch 2014-04-11 21:45:37 UTC (rev 210209) +++ 0002-snapshot-zero-cow-header-for-read-only-snapshot.patch 2014-04-11 21:59:45 UTC (rev 210210) @@ -1,74 +0,0 @@ -From d5c2c146ee050905a175b73dd3d0155f46d5cf81 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac <[email protected]> -Date: Wed, 26 Feb 2014 00:17:11 +0100 -Subject: [PATCH 2/2] snapshot: zero cow header for read-only snapshot -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When read-only snapshot was created, tool was skipping header -initialization of cow device. If it happened device has been -already containing header from some previous snapshot, it's -been 'reused' for a newly created snapshot instead of being cleared. - -Conflicts: - WHATS_NEW - -[Backported to 2.02.105 by Thomas Bächler ([email protected])] ---- - WHATS_NEW | 1 + - test/shell/snapshot-usage.sh | 11 +++++++++++ - tools/lvcreate.c | 8 ++++++-- - 3 files changed, 18 insertions(+), 2 deletions(-) - -diff --git a/WHATS_NEW b/WHATS_NEW -index d2a3482..eeb3517 100644 ---- a/WHATS_NEW -+++ b/WHATS_NEW -@@ -1,3 +1,4 @@ -+ Zero snapshot COW header when creating read-only snapshot. - Wipe DM_snapshot_cow signature without prompt in new LVs with blkid wiping. - - Version 2.02.105 - 20th January 2014 -diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh -index 9e6a14f..17abe9b 100644 ---- a/test/shell/snapshot-usage.sh -+++ b/test/shell/snapshot-usage.sh -@@ -128,4 +128,15 @@ vgremove -ff $vg1 - - fi - -+lvremove -f $vg -+ -+# Check snapshot really deletes COW header for read-only snapshot -+aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 1" -+lvcreate -L10 -n $lv1 $vg -+lvcreate -s -L10 -n snap $vg/$lv1 -+# Populate snapshot with some filesystem signatures -+mkfs.ext4 "$DM_DEV_DIR/$vg/snap" -+lvremove -f $vg/snap -+lvcreate -s -pr -l12 -n snap $vg/$lv1 -+ - vgremove -ff $vg -diff --git a/tools/lvcreate.c b/tools/lvcreate.c -index d0ca7bc..e8270c4 100644 ---- a/tools/lvcreate.c -+++ b/tools/lvcreate.c -@@ -644,8 +644,12 @@ static int _read_activation_params(struct lvcreate_params *lp, struct cmd_contex - lp->permission = arg_uint_value(cmd, permission_ARG, - LVM_READ | LVM_WRITE); - -- /* Must not zero/wipe read only volume */ -- if (!(lp->permission & LVM_WRITE)) { -+ if (lp->snapshot) { -+ /* Snapshot has to zero COW header */ -+ lp->zero = 1; -+ lp->wipe_signatures = 0; -+ } else if (!(lp->permission & LVM_WRITE)) { -+ /* Must not zero/wipe read only volume */ - lp->zero = 0; - lp->wipe_signatures = 0; - } --- -1.9.0 - Modified: PKGBUILD =================================================================== --- PKGBUILD 2014-04-11 21:45:37 UTC (rev 210209) +++ PKGBUILD 2014-04-11 21:59:45 UTC (rev 210210) @@ -4,8 +4,8 @@ pkgbase=lvm2 pkgname=('lvm2' 'device-mapper') -pkgver=2.02.105 -pkgrel=2 +pkgver=2.02.106 +pkgrel=1 arch=('i686' 'x86_64') url="http://sourceware.org/lvm2/" license=('GPL2' 'LGPL2.1') @@ -21,11 +21,8 @@ dmeventd.socket lvm-monitoring.service lvmetad.service - lvmetad.socket - 0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch - 0002-snapshot-zero-cow-header-for-read-only-snapshot.patch - lvm2-2.02.105-readline-6.3.patch) -sha1sums=('796163e766480cdc427cd443dc1336ae8e8e3bd7' + lvmetad.socket) +sha1sums=('0943d1c401675dfdc2118b9ad4fd4d7fb50eaaff' 'SKIP' '76e83966d1bc84f9a1e30bcaff84b8b8fefbca0f' 'ff0fdf0a3005a41acd4b36865056109effc3474b' @@ -36,19 +33,12 @@ '1d56f47a81350ae37ffbf61ee036fe31f4c5d504' 'aad90fce0e12eda41d38571d8eb27c5d5a8c59ec' 'f857a4a63fcc604a981e56875edda91767d4f1bf' - 'fcfc265e3b10294cc4b10949a342e9db4310b186' - '044d426c49919b5a86fd84228d1c7e1f3a86c59a' - '4f83555347e7c3596c53d9009f260c1d65639e6d' - '8a89e784dee91872afe87083f7dd56c2fbc93229') + 'fcfc265e3b10294cc4b10949a342e9db4310b186') prepare() { cd LVM2.${pkgver} # enable lvmetad sed -i 's|use_lvmetad = 0|use_lvmetad = 1|' conf/example.conf.in - - patch -p1 -i "${srcdir}"/0001-wiping-wipe-DM_snapshot_cow-signature-without-prompt.patch - patch -p1 -i "${srcdir}"/0002-snapshot-zero-cow-header-for-read-only-snapshot.patch - patch -p1 -i "${srcdir}"/lvm2-2.02.105-readline-6.3.patch } build() { Deleted: lvm2-2.02.105-readline-6.3.patch =================================================================== --- lvm2-2.02.105-readline-6.3.patch 2014-04-11 21:45:37 UTC (rev 210209) +++ lvm2-2.02.105-readline-6.3.patch 2014-04-11 21:59:45 UTC (rev 210210) @@ -1,48 +0,0 @@ -https://bugs.gentoo.org/503234 - -From 216c57eed72fee52e99bb5d014c9de535e631f58 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac <[email protected]> -Date: Thu, 6 Mar 2014 16:04:19 +0100 -Subject: [PATCH] readline: switch to new-style readline typedef - -Based on patch: -https://www.redhat.com/archives/lvm-devel/2014-March/msg00015.html - -The CPPFunction typedef (among others) have been deprecated in favour of -specific prototyped typedefs since readline 4.2 (circa 2001). -It's been working since because compatibility typedefs have been in -place until they where removed in the recent readline 6.3 release. -Switch to the new style to avoid build breakage. - -But also add full backward compatibility with define. - -Signed-off-by: Gustavo Zacarias <gustavo zacarias com ar> ---- - WHATS_NEW | 1 + - tools/lvm.c | 3 ++- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tools/lvm.c b/tools/lvm.c -index 51e9293..f9ab438 100644 ---- a/tools/lvm.c -+++ b/tools/lvm.c -@@ -27,6 +27,7 @@ int main(int argc, char **argv) - # include <readline/history.h> - # ifndef HAVE_RL_COMPLETION_MATCHES - # define rl_completion_matches(a, b) completion_matches((char *)a, b) -+# define rl_completion_func_t CPPFunction - # endif - - static struct cmdline_context *_cmdline; -@@ -185,7 +186,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline) - char *input = NULL, *args[MAX_ARGS], **argv; - - rl_readline_name = "lvm"; -- rl_attempted_completion_function = (CPPFunction *) _completion; -+ rl_attempted_completion_function = (rl_completion_func_t *) _completion; - - _read_history(cmd); - --- -1.9.0 -
