7f9b3f4598
- 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
122 lines
4.1 KiB
Diff
122 lines
4.1 KiB
Diff
From 7833c45fbe79e49ac22e50b90917b7d7ff2d78ac Mon Sep 17 00:00:00 2001
|
|
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
Date: Fri, 23 Aug 2019 13:08:34 +0200
|
|
Subject: [PATCH] activation: extend handling of pending_delete
|
|
|
|
With previous patch 30a98e4d6710a543692d40d11428ae4baea11b7b we
|
|
started to put devices one pending_delete list instead
|
|
of directly scheduling their removal.
|
|
|
|
However we have operations like 'snapshot merge' where we are
|
|
resuming device tree in 2 subsequent activation calls - so
|
|
1st such call will still have suspened devices and no chance
|
|
to push 'remove' ioctl.
|
|
|
|
Since we curently cannot easily solve this by doing just single
|
|
activation call (which would be preferred solution) - we introduce
|
|
a preservation of pending_delete via command structure and
|
|
then restore it on next activation call.
|
|
|
|
This way we keep to remove devices later - although it might be
|
|
not the best moment - this may need futher tunning.
|
|
|
|
Also we don't keep the list of operation in 1 trasaction
|
|
(unless we do verify udev symlinks) - this could probably
|
|
also make it more correct in terms of which 'remove' can
|
|
be combined we already running 'resume'.
|
|
---
|
|
lib/activate/dev_manager.c | 24 +++++++++++-------------
|
|
lib/commands/toolcontext.c | 8 ++++++++
|
|
lib/commands/toolcontext.h | 1 +
|
|
3 files changed, 20 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
|
|
index 3168e88031..74dbc609c3 100644
|
|
--- a/lib/activate/dev_manager.c
|
|
+++ b/lib/activate/dev_manager.c
|
|
@@ -3612,6 +3612,7 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, const
|
|
if (!dm_tree_deactivate_children(root, dl->str, strlen(dl->str)))
|
|
return_0;
|
|
}
|
|
+ dm_list_init(&dm->pending_delete);
|
|
}
|
|
|
|
return 1;
|
|
@@ -3738,25 +3739,22 @@ out_no_root:
|
|
int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv,
|
|
struct lv_activate_opts *laopts)
|
|
{
|
|
+ dm_list_splice(&dm->pending_delete, &lv->vg->cmd->pending_delete);
|
|
+
|
|
if (!_tree_action(dm, lv, laopts, ACTIVATE))
|
|
return_0;
|
|
|
|
- /*
|
|
- * When lvm2 resumes a device and shortly after that it removes it,
|
|
- * udevd rule will try to blindly call 'dmsetup info' on already removed
|
|
- * device leaving the trace inside syslog about failing operation.
|
|
- *
|
|
- * TODO: It's not completely clear this call here is the best fix.
|
|
- * Maybe there can be a better sequence, but ATM we do usually resume
|
|
- * error device i.e. on cache deletion and remove it.
|
|
- * TODO2: there could be more similar cases!
|
|
- */
|
|
- if (!dm_list_empty(&dm->pending_delete))
|
|
- fs_unlock();
|
|
-
|
|
if (!_tree_action(dm, lv, laopts, CLEAN))
|
|
return_0;
|
|
|
|
+ if (!dm_list_empty(&dm->pending_delete)) {
|
|
+ log_debug("Preserving %d device(s) for removal while being suspended.",
|
|
+ dm_list_size(&dm->pending_delete));
|
|
+ if (!(str_list_dup(lv->vg->cmd->mem, &lv->vg->cmd->pending_delete,
|
|
+ &dm->pending_delete)))
|
|
+ return_0;
|
|
+ }
|
|
+
|
|
return 1;
|
|
}
|
|
|
|
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
|
index 1e03ea2357..0a93553617 100644
|
|
--- a/lib/commands/toolcontext.c
|
|
+++ b/lib/commands/toolcontext.c
|
|
@@ -1734,6 +1734,8 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
|
|
cmd->current_settings = cmd->default_settings;
|
|
|
|
cmd->initialized.config = 1;
|
|
+
|
|
+ dm_list_init(&cmd->pending_delete);
|
|
out:
|
|
if (!cmd->initialized.config) {
|
|
destroy_toolcontext(cmd);
|
|
@@ -1922,6 +1924,12 @@ int refresh_toolcontext(struct cmd_context *cmd)
|
|
|
|
cmd->initialized.config = 1;
|
|
|
|
+ if (!dm_list_empty(&cmd->pending_delete)) {
|
|
+ log_debug(INTERNAL_ERROR "Unprocessed pending delete for %d devices.",
|
|
+ dm_list_size(&cmd->pending_delete));
|
|
+ dm_list_init(&cmd->pending_delete);
|
|
+ }
|
|
+
|
|
if (cmd->initialized.connections && !init_connections(cmd))
|
|
return_0;
|
|
|
|
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
|
|
index 655d9f2978..8a20d1f14d 100644
|
|
--- a/lib/commands/toolcontext.h
|
|
+++ b/lib/commands/toolcontext.h
|
|
@@ -239,6 +239,7 @@ struct cmd_context {
|
|
const char *report_list_item_separator;
|
|
const char *time_format;
|
|
unsigned rand_seed;
|
|
+ struct dm_list pending_delete; /* list of LVs for removal */
|
|
};
|
|
|
|
/*
|
|
--
|
|
2.24.0
|
|
|