|
|
26e710 |
test/shell/cache-single-options.sh | 2 +-
|
|
|
26e710 |
tools/lvchange.c | 8 ++++++++
|
|
|
26e710 |
tools/lvconvert.c | 8 ++++++++
|
|
|
26e710 |
3 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
26e710 |
|
|
|
26e710 |
diff --git a/test/shell/cache-single-options.sh b/test/shell/cache-single-options.sh
|
|
|
26e710 |
index da9cbba..6b71b2f 100644
|
|
|
26e710 |
--- a/test/shell/cache-single-options.sh
|
|
|
26e710 |
+++ b/test/shell/cache-single-options.sh
|
|
|
26e710 |
@@ -228,7 +228,7 @@ lvconvert -y --type cache --cachevol $lv2 $vg/$lv1
|
|
|
26e710 |
|
|
|
26e710 |
lvchange -ay $vg/$lv1
|
|
|
26e710 |
|
|
|
26e710 |
-lvchange --cachemode writeback $vg/$lv1
|
|
|
26e710 |
+lvchange -y --cachemode writeback $vg/$lv1
|
|
|
26e710 |
|
|
|
26e710 |
check lv_field $vg/$lv1 cachemode "writeback"
|
|
|
26e710 |
|
|
|
26e710 |
diff --git a/tools/lvchange.c b/tools/lvchange.c
|
|
|
26e710 |
index 7bdf997..92c6524 100644
|
|
|
26e710 |
--- a/tools/lvchange.c
|
|
|
26e710 |
+++ b/tools/lvchange.c
|
|
|
26e710 |
@@ -635,6 +635,14 @@ static int _lvchange_cache(struct cmd_context *cmd,
|
|
|
26e710 |
if (!get_cache_params(cmd, &chunk_size, &format, &mode, &name, &settings))
|
|
|
26e710 |
goto_out;
|
|
|
26e710 |
|
|
|
26e710 |
+ if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv) && (mode == CACHE_MODE_WRITEBACK)) {
|
|
|
26e710 |
+ log_warn("WARNING: repairing a damaged cachevol is not yet possible.");
|
|
|
26e710 |
+ log_warn("WARNING: cache mode writethrough is suggested for safe operation.");
|
|
|
26e710 |
+ if (!arg_count(cmd, yes_ARG) &&
|
|
|
26e710 |
+ yes_no_prompt("Continue using writeback without repair?") == 'n')
|
|
|
26e710 |
+ goto_out;
|
|
|
26e710 |
+ }
|
|
|
26e710 |
+
|
|
|
26e710 |
if ((mode != CACHE_MODE_UNSELECTED) &&
|
|
|
26e710 |
(mode != setting_seg->cache_mode) &&
|
|
|
26e710 |
lv_is_cache(lv)) {
|
|
|
26e710 |
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
|
|
26e710 |
index 24db8d2..ebc2243 100644
|
|
|
26e710 |
--- a/tools/lvconvert.c
|
|
|
26e710 |
+++ b/tools/lvconvert.c
|
|
|
26e710 |
@@ -3401,6 +3401,14 @@ static int _cache_vol_attach(struct cmd_context *cmd,
|
|
|
26e710 |
if (!cache_vol_set_params(cmd, cache_lv, lv_fast, poolmetadatasize, chunk_size, cache_metadata_format, cache_mode, policy_name, policy_settings))
|
|
|
26e710 |
goto_out;
|
|
|
26e710 |
|
|
|
26e710 |
+ if (cache_mode == CACHE_MODE_WRITEBACK) {
|
|
|
26e710 |
+ log_warn("WARNING: repairing a damaged cachevol is not yet possible.");
|
|
|
26e710 |
+ log_warn("WARNING: cache mode writethrough is suggested for safe operation.");
|
|
|
26e710 |
+ if (!arg_count(cmd, yes_ARG) &&
|
|
|
26e710 |
+ yes_no_prompt("Continue using writeback without repair?") == 'n')
|
|
|
26e710 |
+ goto_out;
|
|
|
26e710 |
+ }
|
|
|
26e710 |
+
|
|
|
26e710 |
/*
|
|
|
26e710 |
* lv/cache_lv keeps the same lockd lock it had before, the lock for
|
|
|
26e710 |
* lv_fast is freed, and lv_corig has no lock.
|