[arch-commits] Commit in lvm2/trunk (6 files)
Christian Hesse
eworm at archlinux.org
Mon May 30 19:33:12 UTC 2016
Date: Monday, May 30, 2016 @ 21:33:11
Author: eworm
Revision: 268754
upgpkg: lvm2 2.02.154-3
apply 'liblvm: allow config settings to be read without full lvm cmd' FS#49483
Added:
lvm2/trunk/01-lvm2-make-sockets-static.patch
(from rev 268753, lvm2/trunk/lvm2-make-sockets-static.patch)
lvm2/trunk/02-liblvm_config_settings.patch
lvm2/trunk/03-lvm2_activation_generator.patch
(from rev 268753, lvm2/trunk/lvm2_activation_generator.patch)
Modified:
lvm2/trunk/PKGBUILD
Deleted:
lvm2/trunk/lvm2-make-sockets-static.patch
lvm2/trunk/lvm2_activation_generator.patch
------------------------------------+
01-lvm2-make-sockets-static.patch | 20 +++++
02-liblvm_config_settings.patch | 134 +++++++++++++++++++++++++++++++++++
03-lvm2_activation_generator.patch | 43 +++++++++++
PKGBUILD | 15 ++-
lvm2-make-sockets-static.patch | 20 -----
lvm2_activation_generator.patch | 43 -----------
6 files changed, 206 insertions(+), 69 deletions(-)
Copied: lvm2/trunk/01-lvm2-make-sockets-static.patch (from rev 268753, lvm2/trunk/lvm2-make-sockets-static.patch)
===================================================================
--- 01-lvm2-make-sockets-static.patch (rev 0)
+++ 01-lvm2-make-sockets-static.patch 2016-05-30 19:33:11 UTC (rev 268754)
@@ -0,0 +1,20 @@
+diff -Nur LVM2.2.02.106.orig/scripts/dm_event_systemd_red_hat.socket.in LVM2.2.02.106/scripts/dm_event_systemd_red_hat.socket.in
+--- LVM2.2.02.106.orig/scripts/dm_event_systemd_red_hat.socket.in 2014-04-10 17:38:46.000000000 +0200
++++ LVM2.2.02.106/scripts/dm_event_systemd_red_hat.socket.in 2014-04-26 14:21:10.097269315 +0200
+@@ -8,6 +8,3 @@
+ ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-client
+ SocketMode=0600
+ RemoveOnStop=true
+-
+-[Install]
+-WantedBy=sockets.target
+diff -Nur LVM2.2.02.106.orig/scripts/lvm2_lvmetad_systemd_red_hat.socket.in LVM2.2.02.106/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
+--- LVM2.2.02.106.orig/scripts/lvm2_lvmetad_systemd_red_hat.socket.in 2014-04-10 17:38:46.000000000 +0200
++++ LVM2.2.02.106/scripts/lvm2_lvmetad_systemd_red_hat.socket.in 2014-04-26 14:21:15.287156152 +0200
+@@ -7,6 +7,3 @@
+ ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket
+ SocketMode=0600
+ RemoveOnStop=true
+-
+-[Install]
+-WantedBy=sysinit.target
Added: 02-liblvm_config_settings.patch
===================================================================
--- 02-liblvm_config_settings.patch (rev 0)
+++ 02-liblvm_config_settings.patch 2016-05-30 19:33:11 UTC (rev 268754)
@@ -0,0 +1,134 @@
+From 7fd4119d24eee55323e888dd78c70257d7c97a15 Mon Sep 17 00:00:00 2001
+From: David Teigland <teigland at redhat.com>
+Date: Tue, 17 May 2016 11:54:13 -0500
+Subject: liblvm: allow config settings to be read without full lvm cmd
+
+A program may be using liblvm2app for simply checking a config
+setting in lvm.conf. In this case, a full lvm context is not
+needed, only cmd->cft (which are the config settings read from
+lvm.conf).
+
+lvm_config_find_bool() can now be passed a NULL lvm context
+in which case it will only create cmd->cft, check the config
+setting asked for, and destroy the cmd.
+---
+ lib/commands/toolcontext.c | 43 +++++++++++++++++++++++++++++++++++++++++++
+ lib/commands/toolcontext.h | 8 ++++++++
+ liblvm/lvm_base.c | 23 ++++++++++++++++++++---
+ 3 files changed, 71 insertions(+), 3 deletions(-)
+
+diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
+index 90e5d5a..1e3f14a 100644
+--- a/lib/commands/toolcontext.c
++++ b/lib/commands/toolcontext.c
+@@ -1776,6 +1776,49 @@ bad:
+ return 0;
+ }
+
++void destroy_config_context(struct cmd_context *cmd)
++{
++ _destroy_config(cmd);
++
++ if (cmd->mem)
++ dm_pool_destroy(cmd->mem);
++ if (cmd->libmem)
++ dm_pool_destroy(cmd->libmem);
++
++ dm_free(cmd);
++}
++
++/*
++ * A "config context" is a very light weight toolcontext that
++ * is only used for reading config settings from lvm.conf.
++ */
++struct cmd_context *create_config_context(void)
++{
++ struct cmd_context *cmd;
++
++ if (!(cmd = dm_zalloc(sizeof(*cmd))))
++ goto_out;
++
++ strcpy(cmd->system_dir, DEFAULT_SYS_DIR);
++
++ if (!_get_env_vars(cmd))
++ goto_out;
++
++ if (!(cmd->libmem = dm_pool_create("library", 4 * 1024)))
++ goto_out;
++
++ dm_list_init(&cmd->config_files);
++
++ if (!_init_lvm_conf(cmd))
++ goto_out;
++
++ return cmd;
++out:
++ if (cmd)
++ destroy_config_context(cmd);
++ return NULL;
++}
++
+ /* Entry point */
+ struct cmd_context *create_toolcontext(unsigned is_long_lived,
+ const char *system_dir,
+diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
+index c3b9b2e..2cecf27 100644
+--- a/lib/commands/toolcontext.h
++++ b/lib/commands/toolcontext.h
+@@ -218,6 +218,14 @@ int init_lvmcache_orphans(struct cmd_context *cmd);
+ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache);
+ int init_connections(struct cmd_context *cmd);
+
++/*
++ * A config context is a very light weight cmd struct that
++ * is only used for reading config settings from lvm.conf,
++ * which are at cmd->cft.
++ */
++struct cmd_context *create_config_context(void);
++void destroy_config_context(struct cmd_context *cmd);
++
+ struct format_type *get_format_by_name(struct cmd_context *cmd, const char *format);
+
+ const char *system_id_from_string(struct cmd_context *cmd, const char *str);
+diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c
+index 8b4def2..fce994c 100644
+--- a/liblvm/lvm_base.c
++++ b/liblvm/lvm_base.c
+@@ -126,14 +126,31 @@ int lvm_config_override(lvm_t libh, const char *config_settings)
+ return rc;
+ }
+
++/*
++ * When full lvm connection is not being used, libh can be NULL
++ * and this command will internally create a single-use, light-weight
++ * cmd struct that only has cmd->cft populated from lvm.conf.
++ */
+ int lvm_config_find_bool(lvm_t libh, const char *config_path, int fail)
+ {
+ int rc = 0;
+- struct cmd_context *cmd = (struct cmd_context *)libh;
+- struct saved_env e = store_user_env((struct cmd_context *)libh);
++ struct cmd_context *cmd;
++ struct saved_env e;
++
++ if (libh) {
++ cmd = (struct cmd_context *)libh;
++ e = store_user_env((struct cmd_context *)libh);
++ } else {
++ if (!(cmd = create_config_context()))
++ return 0;
++ }
+
+ rc = dm_config_tree_find_bool(cmd->cft, config_path, fail);
+- restore_user_env(&e);
++
++ if (libh)
++ restore_user_env(&e);
++ else
++ destroy_config_context(cmd);
+ return rc;
+ }
+
+--
+cgit v0.12-38-g4150
+
Copied: lvm2/trunk/03-lvm2_activation_generator.patch (from rev 268753, lvm2/trunk/lvm2_activation_generator.patch)
===================================================================
--- 03-lvm2_activation_generator.patch (rev 0)
+++ 03-lvm2_activation_generator.patch 2016-05-30 19:33:11 UTC (rev 268754)
@@ -0,0 +1,43 @@
+From 591ef307b30c2d828b2a0c59918203f970974bbb Mon Sep 17 00:00:00 2001
+From: David Teigland <teigland at redhat.com>
+Date: Tue, 17 May 2016 12:03:25 -0500
+Subject: lvm2_activation_generator: don't create full context for liblvm2app
+
+Don't use lvm_init() to create a full command context, which
+does a lot of command setup (like connecting to daemons), which
+is unnecessary for simply reading a value from lvm.conf.
+
+Passing a NULL context arg to the lvm_config_ function is now
+allowed, in which case lvm.conf is read without doing lvm
+command setup.
+---
+ scripts/lvm2_activation_generator_systemd_red_hat.c | 12 +++---------
+ 1 file changed, 3 insertions(+), 9 deletions(-)
+
+diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
+index 62467bd..d83e721 100644
+--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
++++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
+@@ -69,16 +69,10 @@ static void kmsg(int log_level, const char *format, ...)
+
+ static void lvm_get_use_lvmetad_and_lvmpolld(int *use_lvmetad, int *use_lvmpolld)
+ {
+- lvm_t lvm;
+-
+ *use_lvmetad = *use_lvmpolld = 0;
+- if (!(lvm = lvm_init(NULL))) {
+- kmsg(LOG_ERR, "LVM: Failed to initialize library context for activation generator.\n");
+- return;
+- }
+- *use_lvmetad = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMETAD, 0);
+- *use_lvmpolld = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMPOLLD, 0);
+- lvm_quit(lvm);
++
++ *use_lvmetad = lvm_config_find_bool(NULL, LVM_CONF_USE_LVMETAD, 0);
++ *use_lvmpolld = lvm_config_find_bool(NULL, LVM_CONF_USE_LVMPOLLD, 0);
+ }
+
+ static int register_unit_with_target(const char *dir, const char *unit, const char *target)
+--
+cgit v0.12-38-g4150
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2016-05-30 18:38:19 UTC (rev 268753)
+++ PKGBUILD 2016-05-30 19:33:11 UTC (rev 268754)
@@ -5,7 +5,7 @@
pkgbase=lvm2
pkgname=('lvm2' 'device-mapper')
pkgver=2.02.154
-pkgrel=2
+pkgrel=3
arch=('i686' 'x86_64')
url="http://sourceware.org/lvm2/"
license=('GPL2' 'LGPL2.1')
@@ -16,8 +16,9 @@
lvm2_hook
sd-lvm2_install
11-dm-initramfs.rules
- lvm2-make-sockets-static.patch
- lvm2_activation_generator.patch)
+ 01-lvm2-make-sockets-static.patch
+ 02-liblvm_config_settings.patch
+ 03-lvm2_activation_generator.patch)
sha1sums=('6b594f2b23e85bf5bf74a4c4a75817e84e5a0853'
'SKIP'
'056bb0227d07e35a3d365db02f439585314cfc76'
@@ -25,6 +26,7 @@
'f6ac78163ab3aba5b51a71655d6e53d05014bfa4'
'f6a554eea9557c3c236df2943bb6e7e723945c41'
'b084512af42f2e16cdccd8b7ee4de27b574d1f94'
+ '6e1b0e34f66db7414413194c828aa9bb9629dc81'
'8f9804c11a09086f4954a3b8a19623e004b40b02')
validpgpkeys=('88437EF5C077BD113D3B7224228191C1567E2C17')
@@ -35,10 +37,11 @@
sed -i 's|use_lvmetad = 0|use_lvmetad = 1|' conf/example.conf.in
# make systemd sockets static
- patch -p1 -i "${srcdir}/lvm2-make-sockets-static.patch"
+ patch -p1 -i "${srcdir}/01-lvm2-make-sockets-static.patch"
- # lvm2_activation_generator: don't create full context for liblvm2app
- patch -p1 -i "${srcdir}/lvm2_activation_generator.patch"
+ # FS#49483: [lvm2] lvm2-activation-generator wrongly syncs on ipc
+ patch -p1 -i "${srcdir}/02-liblvm_config_settings.patch"
+ patch -p1 -i "${srcdir}/03-lvm2_activation_generator.patch"
}
build() {
Deleted: lvm2-make-sockets-static.patch
===================================================================
--- lvm2-make-sockets-static.patch 2016-05-30 18:38:19 UTC (rev 268753)
+++ lvm2-make-sockets-static.patch 2016-05-30 19:33:11 UTC (rev 268754)
@@ -1,20 +0,0 @@
-diff -Nur LVM2.2.02.106.orig/scripts/dm_event_systemd_red_hat.socket.in LVM2.2.02.106/scripts/dm_event_systemd_red_hat.socket.in
---- LVM2.2.02.106.orig/scripts/dm_event_systemd_red_hat.socket.in 2014-04-10 17:38:46.000000000 +0200
-+++ LVM2.2.02.106/scripts/dm_event_systemd_red_hat.socket.in 2014-04-26 14:21:10.097269315 +0200
-@@ -8,6 +8,3 @@
- ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-client
- SocketMode=0600
- RemoveOnStop=true
--
--[Install]
--WantedBy=sockets.target
-diff -Nur LVM2.2.02.106.orig/scripts/lvm2_lvmetad_systemd_red_hat.socket.in LVM2.2.02.106/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
---- LVM2.2.02.106.orig/scripts/lvm2_lvmetad_systemd_red_hat.socket.in 2014-04-10 17:38:46.000000000 +0200
-+++ LVM2.2.02.106/scripts/lvm2_lvmetad_systemd_red_hat.socket.in 2014-04-26 14:21:15.287156152 +0200
-@@ -7,6 +7,3 @@
- ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket
- SocketMode=0600
- RemoveOnStop=true
--
--[Install]
--WantedBy=sysinit.target
Deleted: lvm2_activation_generator.patch
===================================================================
--- lvm2_activation_generator.patch 2016-05-30 18:38:19 UTC (rev 268753)
+++ lvm2_activation_generator.patch 2016-05-30 19:33:11 UTC (rev 268754)
@@ -1,43 +0,0 @@
-From 591ef307b30c2d828b2a0c59918203f970974bbb Mon Sep 17 00:00:00 2001
-From: David Teigland <teigland at redhat.com>
-Date: Tue, 17 May 2016 12:03:25 -0500
-Subject: lvm2_activation_generator: don't create full context for liblvm2app
-
-Don't use lvm_init() to create a full command context, which
-does a lot of command setup (like connecting to daemons), which
-is unnecessary for simply reading a value from lvm.conf.
-
-Passing a NULL context arg to the lvm_config_ function is now
-allowed, in which case lvm.conf is read without doing lvm
-command setup.
----
- scripts/lvm2_activation_generator_systemd_red_hat.c | 12 +++---------
- 1 file changed, 3 insertions(+), 9 deletions(-)
-
-diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
-index 62467bd..d83e721 100644
---- a/scripts/lvm2_activation_generator_systemd_red_hat.c
-+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
-@@ -69,16 +69,10 @@ static void kmsg(int log_level, const char *format, ...)
-
- static void lvm_get_use_lvmetad_and_lvmpolld(int *use_lvmetad, int *use_lvmpolld)
- {
-- lvm_t lvm;
--
- *use_lvmetad = *use_lvmpolld = 0;
-- if (!(lvm = lvm_init(NULL))) {
-- kmsg(LOG_ERR, "LVM: Failed to initialize library context for activation generator.\n");
-- return;
-- }
-- *use_lvmetad = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMETAD, 0);
-- *use_lvmpolld = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMPOLLD, 0);
-- lvm_quit(lvm);
-+
-+ *use_lvmetad = lvm_config_find_bool(NULL, LVM_CONF_USE_LVMETAD, 0);
-+ *use_lvmpolld = lvm_config_find_bool(NULL, LVM_CONF_USE_LVMPOLLD, 0);
- }
-
- static int register_unit_with_target(const char *dir, const char *unit, const char *target)
---
-cgit v0.12-38-g4150
-
More information about the arch-commits
mailing list