From d7c35663097799e97f09e05ab00e56bbae00e554 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 04 2019 15:41:53 +0000 Subject: import lvm2-2.02.180-10.el7_6.8 --- diff --git a/SOURCES/lvm2-2_02_184-pvscan-lvmetad-init-should-set-updating-before-scann.patch b/SOURCES/lvm2-2_02_184-pvscan-lvmetad-init-should-set-updating-before-scann.patch new file mode 100644 index 0000000..0dfbfd8 --- /dev/null +++ b/SOURCES/lvm2-2_02_184-pvscan-lvmetad-init-should-set-updating-before-scann.patch @@ -0,0 +1,138 @@ + lib/cache/lvmetad.c | 44 ++++++++++++++++++++++++-------------------- + tools/pvscan.c | 9 ++++----- + 2 files changed, 28 insertions(+), 25 deletions(-) + +diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c +index 2a2d7ea..da8c027 100644 +--- a/lib/cache/lvmetad.c ++++ b/lib/cache/lvmetad.c +@@ -312,6 +312,7 @@ retry: + * The caller should do a disk scan to populate lvmetad. + */ + if (!strcmp(daemon_token, "none")) { ++ log_debug_lvmetad("lvmetad initialization needed."); + ret = 0; + goto out; + } +@@ -323,10 +324,16 @@ retry: + * our global filter. + */ + if (strcmp(daemon_token, _lvmetad_token)) { ++ log_debug_lvmetad("lvmetad initialization needed for different filter."); + ret = 0; + goto out; + } + ++ if (wait_start) ++ log_debug_lvmetad("lvmetad initialized during wait."); ++ else ++ log_debug_lvmetad("lvmetad initialized previously."); ++ + out: + daemon_reply_destroy(reply); + return ret; +@@ -2362,28 +2369,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait) + replacing_other_update = 1; + } + +- label_scan(cmd); +- +- lvmcache_pvscan_duplicate_check(cmd); +- +- if (lvmcache_found_duplicate_pvs()) { +- log_warn("WARNING: Scan found duplicate PVs."); +- return 0; +- } +- +- log_verbose("Scanning all devices to update lvmetad."); +- +- if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) { +- log_error("dev_iter creation failed"); +- return 0; +- } +- + future_token = _lvmetad_token; + _lvmetad_token = (char *) LVMETAD_TOKEN_UPDATE_IN_PROGRESS; + + if (!_token_update(&replaced_update)) { +- log_error("Failed to update lvmetad which had an update in progress."); +- dev_iter_destroy(iter); ++ log_error("Failed to start lvmetad update."); + _lvmetad_token = future_token; + return 0; + } +@@ -2399,16 +2389,18 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait) + if (do_wait && !retries) { + retries = 1; + log_warn("WARNING: lvmetad update in progress, retrying update."); +- dev_iter_destroy(iter); + _lvmetad_token = future_token; + goto retry; + } + log_warn("WARNING: lvmetad update in progress, skipping update."); +- dev_iter_destroy(iter); + _lvmetad_token = future_token; + return 0; + } + ++ log_verbose("Scanning all devices to initialize lvmetad."); ++ ++ label_scan(cmd); ++ + log_debug_lvmetad("Telling lvmetad to clear its cache"); + reply = _lvmetad_send(cmd, "pv_clear_all", NULL); + if (!_lvmetad_handle_reply(reply, "pv_clear_all", "", NULL)) +@@ -2418,6 +2410,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait) + was_silent = silent_mode(); + init_silent(1); + ++ if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) { ++ log_error("dev_iter creation failed"); ++ return 0; ++ } ++ + while ((dev = dev_iter_get(iter))) { + if (sigint_caught()) { + ret = 0; +@@ -2453,6 +2450,13 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait) + return 0; + } + ++ /* This will disable lvmetad if label scan found duplicates. */ ++ lvmcache_pvscan_duplicate_check(cmd); ++ if (lvmcache_found_duplicate_pvs()) { ++ log_warn("WARNING: Scan found duplicate PVs."); ++ return 0; ++ } ++ + /* + * If lvmetad is disabled, and no lvm1 metadata was seen and no + * duplicate PVs were seen, then re-enable lvmetad. +diff --git a/tools/pvscan.c b/tools/pvscan.c +index cdccfb5..a5e01b3 100644 +--- a/tools/pvscan.c ++++ b/tools/pvscan.c +@@ -381,7 +381,7 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv) + all_vgs = 1; + goto activate; + } +- ++ + /* + * FIXME: when specific devs are named, we generally don't want to scan + * any other devs, but if lvmetad is not yet populated, the first +@@ -390,11 +390,10 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv) + * never scan any devices other than those specified. + */ + if (!lvmetad_token_matches(cmd)) { +- log_verbose("Scanning all devices to initialize lvmetad."); +- + if (lvmetad_used() && !lvmetad_pvscan_all_devs(cmd, 0)) { +- log_warn("WARNING: Not using lvmetad because cache update failed."); +- lvmetad_make_unused(cmd); ++ log_warn("WARNING: Not updating lvmetad because cache update failed."); ++ ret = ECMD_FAILED; ++ goto out; + } + if (lvmetad_used() && lvmetad_is_disabled(cmd, &reason)) { + log_warn("WARNING: Not using lvmetad because %s.", reason); diff --git a/SPECS/lvm2.spec b/SPECS/lvm2.spec index 11d237a..70a65a2 100644 --- a/SPECS/lvm2.spec +++ b/SPECS/lvm2.spec @@ -67,7 +67,7 @@ Summary: Userland logical volume management tools Name: lvm2 Epoch: 7 Version: 2.02.180 -Release: 10%{?dist}.7%{?scratch} +Release: 10%{?dist}.8%{?scratch} License: GPLv2 Group: System Environment/Base URL: http://sources.redhat.com/lvm2 @@ -132,9 +132,11 @@ Patch47: lvm2-2_02_184-io-warn-when-metadata-size-approaches-io-memory-size.patc Patch48: lvm2-2_02_184-io-increase-the-default-io-memory-from-4-to-8-MiB.patch # BZ 1696740 Patch49: lvm2-2_02_184-dm-migration_threshold-for-old-linked-tools.patch -# Internals; +# Internals: Patch50: lvm2-rhel-config-Change-version-for-backported-config-options.patch Patch51: lvm2-build-make-generate.patch +# BZ 1698750 +Patch52: lvm2-2_02_184-pvscan-lvmetad-init-should-set-updating-before-scann.patch BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel @@ -240,6 +242,7 @@ or more physical volumes and creating one or more logical volumes %patch49 -p1 -b .dm_migration_threshold_for_old_linked_tools %patch50 -p1 -b .rhel_config %patch51 -p1 -b .build_make_generate3 +%patch52 -p1 -b .pvscan_lvmetad_init_set_updating_before_scan %build %global _default_pid_dir /run @@ -511,7 +514,7 @@ systemctl start lvm2-lvmpolld.socket %{_mandir}/man8/lvm-lvpoll.8.gz %endif %attr(755, -, -) %dir %{_sysconfdir}/lvm -%ghost %{_sysconfdir}/lvm/cache/.cache +%ghost %attr(600, -, -) %{_sysconfdir}/lvm/cache/.cache %attr(644, -, -) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf %attr(644, -, -) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvmlocal.conf %attr(755, -, -) %dir %{_sysconfdir}/lvm/profile @@ -987,7 +990,7 @@ the device-mapper event library. %package -n %{boom_pkgname} Summary: %{boom_summary} Version: %{boom_version} -Release: %{boom_release}%{?dist}.7%{?scratch} +Release: %{boom_release}%{?dist}.8%{?scratch} License: GPLv2 Group: System Environment/Base BuildArch: noarch @@ -1018,6 +1021,10 @@ This package provides the python2 version of boom. %endif %changelog +* Mon May 13 2019 Marian Csontos - 7:2.02.180-10.el7_6.8 +- Set updating before scanning in lvmetad to avoid overwriting list of already + seen devices. + * Tue Apr 09 2019 Marian Csontos - 7:2.02.180-10.el7_6.7 - Add io_memory_size configuration option. - Warn when metadata aproaches io_memory_size.