From 52f9f9b1fef2cf553c429893b925876ffa54567c02f42df281ca2b3c25c6b7a1 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 24 Feb 2014 16:32:41 +0000 Subject: [PATCH] Accepting request 223260 from home:arvidjaar:bnc:862076:Factory - add 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch avoid connect to lvmetad.socket too early to prevent deadlock during "systemctl daemon-reload" (bnc#862076) OBS-URL: https://build.opensuse.org/request/show/223260 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=83 --- ...ily-to-avoid-socket-access-on-config.patch | 83 +++++++++++++++++++ lvm2.changes | 7 ++ lvm2.spec | 6 +- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch diff --git a/0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch b/0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch new file mode 100644 index 0000000..bd5263d --- /dev/null +++ b/0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch @@ -0,0 +1,83 @@ +From 983f0b46f2de85b8de0e2d7f8afbdf53f132a87a Mon Sep 17 00:00:00 2001 +From: Petr Rockai +Date: Mon, 29 Oct 2012 21:39:46 +0100 +Subject: [PATCH] lvmetad: Init lazily, to avoid socket access on config + overrides. + +Signed-off-by: Andrey Borzenkov +--- + lib/cache/lvmetad.c | 28 ++++++++++++++++++++++------ + 1 file changed, 22 insertions(+), 6 deletions(-) + +diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c +index 6a374ac..72e07fd 100644 +--- a/lib/cache/lvmetad.c ++++ b/lib/cache/lvmetad.c +@@ -33,7 +33,8 @@ static struct cmd_context *_lvmetad_cmd = NULL; + + void lvmetad_disconnect(void) + { +- daemon_close(_lvmetad); ++ if (_lvmetad_connected) ++ daemon_close(_lvmetad); + _lvmetad_connected = 0; + _lvmetad_cmd = NULL; + } +@@ -41,19 +42,25 @@ void lvmetad_disconnect(void) + void lvmetad_init(struct cmd_context *cmd) + { + if (!_lvmetad_use && !access(LVMETAD_PIDFILE, F_OK)) +- log_warn("WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!"); ++ log_warn("WARNING: lvmetad is running but disabled." ++ " Restart lvmetad before enabling it!"); ++ _lvmetad_cmd = cmd; ++} ++ ++static void _lvmetad_connect() ++{ + if (_lvmetad_use && _lvmetad_socket && !_lvmetad_connected) { + assert(_lvmetad_socket); + _lvmetad = lvmetad_open(_lvmetad_socket); +- if (_lvmetad.socket_fd >= 0 && !_lvmetad.error) { ++ if (_lvmetad.socket_fd >= 0 && !_lvmetad.error) + _lvmetad_connected = 1; +- _lvmetad_cmd = cmd; +- } + } + } + + void lvmetad_warning(void) + { ++ if (!_lvmetad_connected) ++ _lvmetad_connect(); + if (_lvmetad_use && (_lvmetad.socket_fd < 0 || _lvmetad.error)) + log_warn("WARNING: Failed to connect to lvmetad: %s. Falling back to internal scanning.", + strerror(_lvmetad.error)); +@@ -61,7 +68,11 @@ void lvmetad_warning(void) + + int lvmetad_active(void) + { +- return _lvmetad_use && _lvmetad_connected; ++ if (!_lvmetad_use) ++ return 0; ++ if (!_lvmetad_connected) ++ _lvmetad_connect(); ++ return _lvmetad_connected; + } + + void lvmetad_set_active(int active) +@@ -873,6 +884,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler) + char *future_token; + int was_silent; + ++ if (!lvmetad_active()) { ++ log_error("Cannot proceed since lvmetad is not active."); ++ return 0; ++ } ++ + if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) { + log_error("dev_iter creation failed"); + return 0; +-- +1.8.4.5 + diff --git a/lvm2.changes b/lvm2.changes index a5ac6c1..25d0e26 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Feb 20 16:23:21 UTC 2014 - arvidjaar@gmail.com + +- add 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch + avoid connect to lvmetad.socket too early to prevent deadlock during + "systemctl daemon-reload" (bnc#862076) + ------------------------------------------------------------------- Thu Feb 13 06:39:47 UTC 2014 - dmzhang@suse.com diff --git a/lvm2.spec b/lvm2.spec index 0b87beb..83bc436 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -76,12 +76,15 @@ Patch71: make_raid1_default.diff Patch72: suppress_locking_failer_message.patch Patch73: remove-fedora-systemd.patch -# bnc#862076 +#bnc#862076 Patch74: autoactivate-lvmetad-with-generator.patch #fate#315092 Patch75: cmirrord_improvment_performance.patch +#bnc#862076 +Patch76: 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-build # Not a real replacement but we drop evms Provides: evms = 2.5.5 @@ -122,6 +125,7 @@ Volume Manager. %patch73 -p1 %patch74 -p1 %patch75 -p1 +%patch76 -p1 %build #set path so that thin_check can be found