summaryrefslogtreecommitdiff
path: root/lib/commands
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2019-08-23 13:08:34 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2019-08-26 15:16:38 +0200
commit7833c45fbe79e49ac22e50b90917b7d7ff2d78ac (patch)
treec785415d97aa990370e87b8084a1938df20124fd /lib/commands
parenta18f562913aaebf4587531fb40082718ec504f7a (diff)
downloadlvm2-7833c45fbe79e49ac22e50b90917b7d7ff2d78ac.tar.gz
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'.
Diffstat (limited to 'lib/commands')
-rw-r--r--lib/commands/toolcontext.c8
-rw-r--r--lib/commands/toolcontext.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 1e03ea235..0a9355361 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 655d9f297..8a20d1f14 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 */
};
/*