|
|
d6c8c5 |
From 8c34a9b06eab6c40a221730a1b72dcd5e43aabcc Mon Sep 17 00:00:00 2001
|
|
|
d6c8c5 |
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
|
d6c8c5 |
Date: Fri, 12 Jan 2018 13:34:13 +0100
|
|
|
d6c8c5 |
Subject: [PATCH 13/25] lvconvert: use excl activation for conversion
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
Use properly exclusive activation when reactivating origin after
|
|
|
d6c8c5 |
snapshot merge (since origin must have been previously also exlusively
|
|
|
d6c8c5 |
activated).
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
Same applies when converting volumes to thin-pool or cache.
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
Previously used 'only' local activation incorrectly allowed local
|
|
|
d6c8c5 |
activation of some targets (i.e. raid) - thus 'leaking' chance to
|
|
|
d6c8c5 |
activate same device on another node - which can be a problem
|
|
|
d6c8c5 |
for device types like raid.
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
(cherry picked from commit e86910b052ef50dfdaad104d17bda679f698e31f)
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
Conflicts:
|
|
|
d6c8c5 |
WHATS_NEW
|
|
|
d6c8c5 |
---
|
|
|
d6c8c5 |
WHATS_NEW | 1 +
|
|
|
d6c8c5 |
lib/metadata/cache_manip.c | 2 +-
|
|
|
d6c8c5 |
lib/metadata/pool_manip.c | 6 +++---
|
|
|
d6c8c5 |
tools/lvconvert.c | 16 ++++++++--------
|
|
|
d6c8c5 |
4 files changed, 13 insertions(+), 12 deletions(-)
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
diff --git a/WHATS_NEW b/WHATS_NEW
|
|
|
d6c8c5 |
index 9375a86..c997206 100644
|
|
|
d6c8c5 |
--- a/WHATS_NEW
|
|
|
d6c8c5 |
+++ b/WHATS_NEW
|
|
|
d6c8c5 |
@@ -1,5 +1,6 @@
|
|
|
d6c8c5 |
Version 2.02.178 -
|
|
|
d6c8c5 |
=====================================
|
|
|
d6c8c5 |
+ Preserve exclusive activation during thin snaphost merge.
|
|
|
d6c8c5 |
Avoid exceeding array bounds in allocation tag processing.
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
Version 2.02.177 - 18th December 2017
|
|
|
d6c8c5 |
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
|
|
|
d6c8c5 |
index 55ed724..97a3339 100644
|
|
|
d6c8c5 |
--- a/lib/metadata/cache_manip.c
|
|
|
d6c8c5 |
+++ b/lib/metadata/cache_manip.c
|
|
|
d6c8c5 |
@@ -960,7 +960,7 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv)
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
cache_pool_lv->status |= LV_TEMPORARY;
|
|
|
d6c8c5 |
- if (!activate_lv_local(cache_pool_lv->vg->cmd, cache_pool_lv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cache_pool_lv->vg->cmd, cache_pool_lv)) {
|
|
|
d6c8c5 |
log_error("Aborting. Failed to activate cache pool %s.",
|
|
|
d6c8c5 |
display_lvname(cache_pool_lv));
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
|
|
|
d6c8c5 |
index 18e4e65..b832db7 100644
|
|
|
d6c8c5 |
--- a/lib/metadata/pool_manip.c
|
|
|
d6c8c5 |
+++ b/lib/metadata/pool_manip.c
|
|
|
d6c8c5 |
@@ -526,7 +526,7 @@ int create_pool(struct logical_volume *pool_lv,
|
|
|
d6c8c5 |
* or directly converted to invisible device via suspend/resume
|
|
|
d6c8c5 |
*/
|
|
|
d6c8c5 |
pool_lv->status |= LV_TEMPORARY;
|
|
|
d6c8c5 |
- if (!activate_lv_local(pool_lv->vg->cmd, pool_lv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(pool_lv->vg->cmd, pool_lv)) {
|
|
|
d6c8c5 |
log_error("Aborting. Failed to activate pool metadata %s.",
|
|
|
d6c8c5 |
display_lvname(pool_lv));
|
|
|
d6c8c5 |
goto bad;
|
|
|
d6c8c5 |
@@ -538,7 +538,7 @@ int create_pool(struct logical_volume *pool_lv,
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
pool_lv->status &= ~LV_TEMPORARY;
|
|
|
d6c8c5 |
/* Deactivates cleared metadata LV */
|
|
|
d6c8c5 |
- if (!deactivate_lv_local(pool_lv->vg->cmd, pool_lv)) {
|
|
|
d6c8c5 |
+ if (!deactivate_lv(pool_lv->vg->cmd, pool_lv)) {
|
|
|
d6c8c5 |
log_error("Aborting. Could not deactivate pool metadata %s.",
|
|
|
d6c8c5 |
display_lvname(pool_lv));
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
@@ -660,7 +660,7 @@ static struct logical_volume *_alloc_pool_metadata_spare(struct volume_group *vg
|
|
|
d6c8c5 |
return_0;
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
/* Spare LV should not be active */
|
|
|
d6c8c5 |
- if (!deactivate_lv_local(vg->cmd, lv)) {
|
|
|
d6c8c5 |
+ if (!deactivate_lv(vg->cmd, lv)) {
|
|
|
d6c8c5 |
log_error("Unable to deactivate pool metadata spare LV. "
|
|
|
d6c8c5 |
"Manual intervention required.");
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
|
|
d6c8c5 |
index deb7cc9..fee0a4e 100644
|
|
|
d6c8c5 |
--- a/tools/lvconvert.c
|
|
|
d6c8c5 |
+++ b/tools/lvconvert.c
|
|
|
d6c8c5 |
@@ -1970,14 +1970,14 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
|
|
|
d6c8c5 |
log_warn("WARNING: %s not zeroed.", snap_name);
|
|
|
d6c8c5 |
else {
|
|
|
d6c8c5 |
lv->status |= LV_TEMPORARY;
|
|
|
d6c8c5 |
- if (!activate_lv_local(cmd, lv) ||
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cmd, lv) ||
|
|
|
d6c8c5 |
!wipe_lv(lv, (struct wipe_params) { .do_zero = 1 })) {
|
|
|
d6c8c5 |
log_error("Aborting. Failed to wipe snapshot exception store.");
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
lv->status &= ~LV_TEMPORARY;
|
|
|
d6c8c5 |
/* Deactivates cleared metadata LV */
|
|
|
d6c8c5 |
- if (!deactivate_lv_local(lv->vg->cmd, lv)) {
|
|
|
d6c8c5 |
+ if (!deactivate_lv(lv->vg->cmd, lv)) {
|
|
|
d6c8c5 |
log_error("Failed to deactivate zeroed snapshot exception store.");
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
@@ -2170,7 +2170,7 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd,
|
|
|
d6c8c5 |
log_print_unless_silent("Volume %s replaced origin %s.",
|
|
|
d6c8c5 |
display_lvname(origin), display_lvname(lv));
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
- if (origin_is_active && !activate_lv(cmd, lv)) {
|
|
|
d6c8c5 |
+ if (origin_is_active && !activate_lv_excl_local(cmd, lv)) {
|
|
|
d6c8c5 |
log_error("Failed to reactivate origin %s.",
|
|
|
d6c8c5 |
display_lvname(lv));
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
@@ -2278,13 +2278,13 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
- if (!activate_lv_local(cmd, pmslv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cmd, pmslv)) {
|
|
|
d6c8c5 |
log_error("Cannot activate pool metadata spare volume %s.",
|
|
|
d6c8c5 |
pmslv->name);
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
- if (!activate_lv_local(cmd, mlv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cmd, mlv)) {
|
|
|
d6c8c5 |
log_error("Cannot activate thin pool metadata volume %s.",
|
|
|
d6c8c5 |
mlv->name);
|
|
|
d6c8c5 |
goto deactivate_pmslv;
|
|
|
d6c8c5 |
@@ -2476,13 +2476,13 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
- if (!activate_lv_local(cmd, pmslv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cmd, pmslv)) {
|
|
|
d6c8c5 |
log_error("Cannot activate pool metadata spare volume %s.",
|
|
|
d6c8c5 |
pmslv->name);
|
|
|
d6c8c5 |
return 0;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
- if (!activate_lv_local(cmd, mlv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cmd, mlv)) {
|
|
|
d6c8c5 |
log_error("Cannot activate cache pool metadata volume %s.",
|
|
|
d6c8c5 |
mlv->name);
|
|
|
d6c8c5 |
goto deactivate_pmslv;
|
|
|
d6c8c5 |
@@ -3130,7 +3130,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
|
|
d6c8c5 |
|
|
|
d6c8c5 |
if (zero_metadata) {
|
|
|
d6c8c5 |
metadata_lv->status |= LV_TEMPORARY;
|
|
|
d6c8c5 |
- if (!activate_lv_local(cmd, metadata_lv)) {
|
|
|
d6c8c5 |
+ if (!activate_lv_excl_local(cmd, metadata_lv)) {
|
|
|
d6c8c5 |
log_error("Aborting. Failed to activate metadata lv.");
|
|
|
d6c8c5 |
goto bad;
|
|
|
d6c8c5 |
}
|
|
|
d6c8c5 |
--
|
|
|
d6c8c5 |
1.8.3.1
|
|
|
d6c8c5 |
|