lvm2/bug-1158628_08-lv_manip-add-synchronizations.patch
Gang He 7f9b3f4598 Accepting request 755483 from home:hmzhao:branches:openSUSE:Factory
- backport patches for lvm2 to avoid software abnormal work (bsc#1158861)
  + bug-1158861_01-config-remove-filter-typo.patch
  + bug-1158861_02-config-Fix-default-option-which-makes-no-sense.patch
  + bug-1158861_03-vgchange-don-t-fail-monitor-command-if-vg-is-exporte.patch
  + bug-1158861_04-fix-duplicate-pv-size-check.patch
  + bug-1158861_05-hints-fix-copy-of-filter.patch
  + bug-1158861_06-fix-segfault-for-invalid-characters-in-vg-name.patch
  + bug-1158861_07-vgck-let-updatemetadata-repair-mismatched-metadata.patch
  + bug-1158861_08-hints-fix-mem-leaking-buffers.patch
  + bug-1158861_09-pvcreate-pvremove-fix-reacquiring-global-lock-after.patch
- add necessary patches for passing lvm2 testsuite (bsc#1158628)
  + bug-1158628_01-tests-replaces-grep-q-usage.patch
  + bug-1158628_02-tests-fix-ra-checking.patch
  + bug-1158628_03-tests-simplify-some-var-settings.patch
  + bug-1158628-04-pvmove-correcting-read_ahead-setting.patch
  + bug-1158628_05-activation-add-synchronization-point.patch
  + bug-1158628_06-pvmove-add-missing-synchronization.patch
  + bug-1158628_07-activation-extend-handling-of-pending_delete.patch
  + bug-1158628_08-lv_manip-add-synchronizations.patch
  + bug-1158628_09-lvconvert-improve-validation-thin-and-cache-pool-con.patch
  + bug-1158628_10-thin-activate-layer-pool-aas-read-only-LV.patch
  + bug-1158628_11-tests-mdadm-stop-in-test-cleanup.patch
  + bug-1158628_12-test-increase-size-of-raid10-LV-allowing-tests-to-su.patch
  + bug-1158628_13-lvconvert-fix-return-value-when-zeroing-fails.patch
  + bug-1158628_14-tests-add-extra-settle.patch
  + bug-1158628_15-test-Fix-handling-leftovers-from-previous-tests.patch

OBS-URL: https://build.opensuse.org/request/show/755483
OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=260
2019-12-10 09:29:09 +00:00

113 lines
3.7 KiB
Diff

From 4b1dcc2eebb27cae54b4c618ab31072bdb230ea9 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 26 Aug 2019 13:28:17 +0200
Subject: [PATCH] lv_manip: add synchronizations
New udev in rawhide seems to be 'dropping' udev rule operations for devices
that are no longer existing - while this is 'probably' a bug - it's
revealing moments in lvm2 that likely should not run in a single
transaction and we should wait for a cookie before submitting more work.
TODO: it seem more 'error' paths should always include synchronization
before starting deactivating 'just activated' devices.
We should probably figure out some 'automatic' solution for this instead
of placing sync_local_dev_name() all over the place...
---
lib/metadata/lv_manip.c | 14 +++++++++++---
lib/metadata/snapshot_manip.c | 5 +++++
lib/metadata/thin_manip.c | 6 ++++++
tools/lvconvert.c | 12 ++++++++++++
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index af3a16fe2d..6451368772 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5830,9 +5830,17 @@ out:
ret = 1;
bad:
- if (activated && !deactivate_lv(cmd, lock_lv)) {
- log_error("Problem deactivating %s.", display_lvname(lock_lv));
- ret = 0;
+ if (activated) {
+ if (!sync_local_dev_names(lock_lv->vg->cmd)) {
+ log_error("Failed to sync local devices before deactivating LV %s.",
+ display_lvname(lock_lv));
+ return 0;
+ }
+
+ if (!deactivate_lv(cmd, lock_lv)) {
+ log_error("Problem deactivating %s.", display_lvname(lock_lv));
+ ret = 0;
+ }
}
return ret;
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 65d8dbd13f..d105942c0f 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -292,6 +292,11 @@ int vg_remove_snapshot(struct logical_volume *cow)
if (is_origin_active &&
lv_is_virtual_origin(origin)) {
+ if (!sync_local_dev_names(origin->vg->cmd)) {
+ log_error("Failed to sync local devices before deactivating origin LV %s.",
+ display_lvname(origin));
+ return 0;
+ }
if (!deactivate_lv(origin->vg->cmd, origin)) {
log_error("Failed to deactivate logical volume \"%s\"",
origin->name);
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index b9c01ee215..f94797620f 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -529,6 +529,12 @@ int update_pool_lv(struct logical_volume *lv, int activate)
}
}
+ if (!sync_local_dev_names(lv->vg->cmd)) {
+ log_error("Failed to sync local devices LV %s.",
+ display_lvname(lv));
+ return 0;
+ }
+
if (activate &&
!deactivate_lv(lv->vg->cmd, lv)) {
log_error("Failed to deactivate %s.", display_lvname(lv));
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index ebc22433f8..31f9296769 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2513,6 +2513,12 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,
/* TODO: any active validation of cache-pool metadata? */
deactivate_mlv:
+ if (!sync_local_dev_names(cmd)) {
+ log_error("Failed to sync local devices before deactivating LV %s.",
+ display_lvname(mlv));
+ return 0;
+ }
+
if (!deactivate_lv(cmd, mlv)) {
log_error("Cannot deactivate pool metadata volume %s.",
display_lvname(mlv));
@@ -2520,6 +2526,12 @@ deactivate_mlv:
}
deactivate_pmslv:
+ if (!sync_local_dev_names(cmd)) {
+ log_error("Failed to sync local devices before deactivating LV %s.",
+ display_lvname(pmslv));
+ return 0;
+ }
+
if (!deactivate_lv(cmd, pmslv)) {
log_error("Cannot deactivate pool metadata spare volume %s.",
display_lvname(pmslv));
--
2.24.0