summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-08-24 10:05:09 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-08-29 20:51:15 +0200
commit81970d22d8a841c1ea69fde5c9108fc4df3759bd (patch)
tree20a4ddf9de7d23a9d8709111a11f9c9b0c7b8655
parentb493811968b34876ef558ad04d18c1b76bd28113 (diff)
downloadlvm2-81970d22d8a841c1ea69fde5c9108fc4df3759bd.tar.gz
cache: do not monitor cache-pool
Avoid monitoring of activated cache-pool - where the only purpose ATM is to clear metadata volume which is actually activate in place of cache-pool name (using public LV name). Since VG lock is held across whole clear operation, dmeventd cannot be used anyway - however in case of appliction crash we may leave unmonitored device. In future we may provide better mechanism as the current name replacemnet is creating 'uncommon' table setups in case the metadata LV is more complex type like raid (needs some futher thinking about error path results). Another point to think about is the fact we should not clear device while holding lock (i.e. dmeventd mirror repair cannot work in cases like this).
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/activate/activate.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 76e203dde..6980e17fb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.165 -
===================================
+ Do not monitor cache-pool metadata when LV is just being cleared.
Add allocation/cache_pool_max_chunks to prevent misuse of cache target.
Give error not segfault in lvconvert --splitmirrors when PV lies outside LV.
Fix typo in report/columns_as_rows config option name recognition (2.02.99).
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index f4d3a1740..997729124 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1724,6 +1724,23 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
return 1;
/*
+ * Activation of unused cache-pool activates metadata device as
+ * a public LV for clearing purpose.
+ * FIXME:
+ * As VG lock is held across whole operation unmonitored volume
+ * is usually OK since dmeventd couldn't do anything.
+ * However in case command would have crashed, such LV is
+ * left unmonitored and may potentially require dmeventd.
+ */
+ if ((lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) &&
+ !lv_is_used_cache_pool((find_pool_seg(first_seg(lv))->lv))) {
+ log_debug_activation("Skipping %smonitor of %s.%s",
+ (monitor) ? "" : "un", display_lvname(lv),
+ (monitor) ? " Cache pool activation for clearing only." : "");
+ return 1;
+ }
+
+ /*
* Allow to unmonitor thin pool via explicit pool unmonitor
* or unmonitor before the last thin pool user deactivation
* Skip unmonitor, if invoked via deactivation of thin volume