stable-2.02 - cache: improve vgremove loop
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c4a6b9ded02ffe68228...
Commit: c4a6b9ded02ffe682285ec4c2706114f6f2bd481
Parent: 4743c4900ddf0558f5949d7d113be9525bf67785
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 26 13:28:00 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:36:41 2019 +0200
cache: improve vgremove loop
Support internal removal of 'cache origin' volume - which we
do not normally expose to a user - however internal processing
loops may hit this condition (depending on order of list LVs).
So when this operation is internally requested - we automatically
try to remove it's 'holding' LV (cache LV) - which will also
remove the origin.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 549366c..fa631ec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.186 -
================================
+ Improve internal removal of cached devices.
Synchronize with udev when dropping snapshot.
Add missing device synchronization point before removing pvmove node.
Correctly set read_ahead for LVs when pvmove is finished.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9e7eff9..87c81c3 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6362,6 +6362,13 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
return 0;
}
+ if (lv_is_cache_origin(lv)) {
+ if (!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "cache origin"))
+ return_0;
+ /* Removal of cache LV also removes caching origin */
+ return 1;
+ }
+
if (lv_is_external_origin(lv) &&
!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "external origin"))
return_0;
4 years, 7 months
stable-2.02 - snapshot: always activate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4743c4900ddf0558f59...
Commit: 4743c4900ddf0558f5949d7d113be9525bf67785
Parent: c6e079cda3d2c15c0dddf34513e045188abbac15
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 26 15:13:55 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:36:41 2019 +0200
snapshot: always activate
Drop the 'cluster-only' optimization so we do resume ALL device
before we try to wait on cookie before 'removal' operation.
It's more correct order of operation - alhtough possibly slightly
less efficient - but until we have correct list of operations
'in-progress' we can't do anything better.
---
lib/metadata/snapshot_manip.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 76d78f3..81e4703 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -361,13 +361,7 @@ int vg_remove_snapshot(struct logical_volume *cow)
return 0;
}
- /*
- * For merged snapshot and clustered VG activate cow LV so
- * the following call to deactivate_lv() can clean-up table
- * entries. For this clustered lock need to be held.
- */
- if (vg_is_clustered(cow->vg) &&
- merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
+ if (merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
log_error("Failed to activate %s.", cow->name);
return 0;
}
4 years, 7 months
stable-2.02 - activation: extend handling of pending_delete
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c6e079cda3d2c15c0dd...
Commit: c6e079cda3d2c15c0dddf34513e045188abbac15
Parent: f55b8e387fbff3697fccf42cbc29e17e96da22fb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 23 13:08:34 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:36:41 2019 +0200
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 1dfd42b..dd585da 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3231,6 +3231,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;
@@ -3357,25 +3358,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 38e382f..c90cb57 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -2002,6 +2002,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);
@@ -2213,6 +2215,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 6e262e8..9c225b8 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -231,6 +231,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 */
};
/*
4 years, 7 months
master - lv_manip: add synchronizations
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b1dcc2eebb27cae54b...
Commit: 4b1dcc2eebb27cae54b4c618ab31072bdb230ea9
Parent: c98e34e4d0edbcb2594e93f06183838de0c6e2bc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 26 13:28:17 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:32:19 2019 +0200
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 af3a16f..6451368 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 65d8dbd..d105942 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 b9c01ee..f947976 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 ebc2243..31f9296 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));
4 years, 7 months
master - cache: improve vgremove loop
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c98e34e4d0edbcb2594...
Commit: c98e34e4d0edbcb2594e93f06183838de0c6e2bc
Parent: af0b84ccc850d619eddef5112753731abce099ed
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 26 13:28:00 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:32:12 2019 +0200
cache: improve vgremove loop
Support internal removal of 'cache origin' volume - which we
do not normally expose to a user - however internal processing
loops may hit this condition (depending on order of list LVs).
So when this operation is internally requested - we automatically
try to remove it's 'holding' LV (cache LV) - which will also
remove the origin.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0b48e03..cb93bbe 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.06 -
================================
+ Improve internal removal of cached devices.
Synchronize with udev when dropping snapshot.
Add missing device synchronization point before removing pvmove node.
Correctly set read_ahead for LVs when pvmove is finished.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 6aee947..af3a16f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6544,6 +6544,13 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
return 0;
}
+ if (lv_is_cache_origin(lv)) {
+ if (!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "cache origin"))
+ return_0;
+ /* Removal of cache LV also removes caching origin */
+ return 1;
+ }
+
if (lv_is_external_origin(lv) &&
!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "external origin"))
return_0;
4 years, 7 months
master - snapshot: always activate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=af0b84ccc850d619edd...
Commit: af0b84ccc850d619eddef5112753731abce099ed
Parent: 7833c45fbe79e49ac22e50b90917b7d7ff2d78ac
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 26 15:13:55 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:23:44 2019 +0200
snapshot: always activate
Drop the 'cluster-only' optimization so we do resume ALL device
before we try to wait on cookie before 'removal' operation.
It's more correct order of operation - alhtough possibly slightly
less efficient - but until we have correct list of operations
'in-progress' we can't do anything better.
---
lib/metadata/snapshot_manip.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 5ccf251..65d8dbd 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -361,13 +361,7 @@ int vg_remove_snapshot(struct logical_volume *cow)
return 0;
}
- /*
- * For merged snapshot and clustered VG activate cow LV so
- * the following call to deactivate_lv() can clean-up table
- * entries. For this clustered lock need to be held.
- */
- if (vg_is_clustered(cow->vg) &&
- merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
+ if (merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
log_error("Failed to activate %s.", cow->name);
return 0;
}
4 years, 7 months
master - activation: extend handling of pending_delete
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7833c45fbe79e49ac22...
Commit: 7833c45fbe79e49ac22e50b90917b7d7ff2d78ac
Parent: a18f562913aaebf4587531fb40082718ec504f7a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 23 13:08:34 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 26 15:16:38 2019 +0200
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 3168e88..74dbc60 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 1e03ea2..0a93553 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 655d9f2..8a20d1f 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 */
};
/*
4 years, 7 months
stable-2.02 - devices: put ifdef around BLKPBSZGET
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f55b8e387fbff3697fc...
Commit: f55b8e387fbff3697fccf42cbc29e17e96da22fb
Parent: 53fcd4fd8fdca852bd8db079f943594c4deeded5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Aug 20 09:32:26 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Aug 20 09:32:26 2019 -0500
devices: put ifdef around BLKPBSZGET
BLKPBSZGET is not defined before kernel version 2.6.32
(e.g. rhel5)
---
lib/device/dev-io.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index fd8d349..0289a17 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -156,6 +156,7 @@ int dev_get_direct_block_sizes(struct device *dev, unsigned int *physical_block_
do_close = 1;
}
+#ifdef BLKPBSZGET /* not defined before kernel version 2.6.32 (e.g. rhel5) */
/*
* BLKPBSZGET from kernel comment for blk_queue_physical_block_size:
* "the lowest possible sector size that the hardware can operate on
@@ -165,6 +166,7 @@ int dev_get_direct_block_sizes(struct device *dev, unsigned int *physical_block_
stack;
pbs = 0;
}
+#endif
/*
* BLKSSZGET from kernel comment for blk_queue_logical_block_size:
4 years, 7 months
stable-2.02 - dmsetup: debug print
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=53fcd4fd8fdca852bd8...
Commit: 53fcd4fd8fdca852bd8db079f943594c4deeded5
Parent: ba629ceea194cc964a6dddb84641254776e58e16
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 16 23:49:38 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 20 12:59:05 2019 +0200
dmsetup: debug print
Udev debugging is a bit tricky, so to more easily pair cookie ID,
which is the lowest 16 bit - print cookie as hexa number.
This simplify pairing of processed cookies while the 'higher bit flags'
are changed for the same cookie.
---
WHATS_NEW_DM | 5 +++--
tools/dmsetup.c | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 718d174..1dc18ec 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
-Version 1.02.160 -
-================================
+Version 1.02.165 -
+=================================
+ Add debug of dmsetup udevcomplete with hexa print DM_COOKIE_COMPLETED.
Fix versioning of dm_stats_create_region and dm_stats_create_region.
Parsing of cache status understand no_discard_passdown.
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index bd080b8..5b21620 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -1694,6 +1694,7 @@ static int _udevcomplete(CMD_ARGS)
if (!(cookie = _get_cookie_value(argv[0])))
return_0;
+ printf("DM_COOKIE_COMPLETED=0x%-10x", cookie);
/*
* Strip flags from the cookie and use cookie magic instead.
* If the cookie has non-zero prefix and the base is zero then
4 years, 7 months
stable-2.02 - activation: add synchronization point
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ba629ceea194cc964a6...
Commit: ba629ceea194cc964a6dddb84641254776e58e16
Parent: e5cdb114a6aa5d211e25a0919a28968d64e7cf01
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 16 23:49:59 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 20 12:59:05 2019 +0200
activation: add synchronization point
Resuming of 'error' table entry followed with it's dirrect removal
is now troublesame with latest udev as it may skip processing of
udev rules for already 'dropped' device nodes.
As we cannot 'synchronize' with udev while we know we have devices
in suspended state - rework 'cleanup' so it collects nodes
for removal into pending_delete list and process the list with
synchronization once we are without any suspended nodes.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 20 ++++++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index fa8508f..549366c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.186 -
================================
+ Synchronize with udev when dropping snapshot.
Add missing device synchronization point before removing pvmove node.
Correctly set read_ahead for LVs when pvmove is finished.
Fix metadata writes from corrupting with large physical block size.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 3e5c0a8..1dfd42b 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3198,13 +3198,6 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, const
const char *name, *uuid;
struct dm_str_list *dl;
- /* Deactivate any tracked pending delete nodes */
- dm_list_iterate_items(dl, &dm->pending_delete) {
- log_debug_activation("Deleting tracked UUID %s.", dl->str);
- if (!dm_tree_deactivate_children(root, dl->str, strlen(dl->str)))
- return_0;
- }
-
while ((child = dm_tree_next_child(&handle, root, 0))) {
if (!(name = dm_tree_node_get_name(child)))
continue;
@@ -3225,10 +3218,21 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, const
if (non_toplevel_tree_dlid && !strcmp(non_toplevel_tree_dlid, uuid))
continue;
- if (!dm_tree_deactivate_children(root, uuid, strlen(uuid)))
+ if (!str_list_add(dm->mem, &dm->pending_delete, uuid))
return_0;
}
+ /* Deactivate any tracked pending delete nodes */
+ if (!dm_list_empty(&dm->pending_delete) && !dm_get_suspended_counter()) {
+ fs_unlock();
+ dm_tree_set_cookie(root, fs_get_cookie());
+ dm_list_iterate_items(dl, &dm->pending_delete) {
+ log_debug_activation("Deleting tracked UUID %s.", dl->str);
+ if (!dm_tree_deactivate_children(root, dl->str, strlen(dl->str)))
+ return_0;
+ }
+ }
+
return 1;
}
4 years, 7 months