]> sourceware.org Git - lvm2.git/commitdiff
cache: warn and prompt for writeback with cachevol
authorDavid Teigland <teigland@redhat.com>
Tue, 2 Jul 2019 15:59:40 +0000 (10:59 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 2 Jul 2019 16:03:03 +0000 (11:03 -0500)
The cache repair utility does not yet work with a cachevol
(where metadata and data exist on the same LV.)  So, warn
and prompt if writeback is specified with a cachevol.

test/shell/cache-single-options.sh
tools/lvchange.c
tools/lvconvert.c

index da9cbbae676df8b381e34700598f93586e65009a..6b71b2f60b5ab9b84e5465c32280aef1be6c365a 100644 (file)
@@ -228,7 +228,7 @@ lvconvert -y --type cache --cachevol $lv2 $vg/$lv1
 
 lvchange -ay $vg/$lv1
 
-lvchange --cachemode writeback $vg/$lv1
+lvchange -y --cachemode writeback $vg/$lv1
 
 check lv_field $vg/$lv1 cachemode "writeback"
 
index e7fb57d1d3db3d1213e29f5384c98a621eda427e..c28a7bb9c307a5dcfbdda9ab7c02d0c0c2dc76a7 100644 (file)
@@ -635,6 +635,14 @@ static int _lvchange_cache(struct cmd_context *cmd,
        if (!get_cache_params(cmd, &chunk_size, &format, &mode, &name, &settings))
                goto_out;
 
+       if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv) && (mode == CACHE_MODE_WRITEBACK)) {
+               log_warn("WARNING: repairing a damaged cachevol is not yet possible.");
+               log_warn("WARNING: cache mode writethrough is suggested for safe operation.");
+               if (!arg_count(cmd, yes_ARG) &&
+                       yes_no_prompt("Continue using writeback without repair?") == 'n')
+                       goto_out;
+       }
+
        if ((mode != CACHE_MODE_UNSELECTED) &&
            (mode != setting_seg->cache_mode) &&
            lv_is_cache(lv)) {
index 24db8d20f6a4125d96192f3daaec6b04e734339d..ebc22433f8e76ac14f746126ace5997629741411 100644 (file)
@@ -3401,6 +3401,14 @@ static int _cache_vol_attach(struct cmd_context *cmd,
        if (!cache_vol_set_params(cmd, cache_lv, lv_fast, poolmetadatasize, chunk_size, cache_metadata_format, cache_mode, policy_name, policy_settings))
                goto_out;
 
+       if (cache_mode == CACHE_MODE_WRITEBACK) {
+               log_warn("WARNING: repairing a damaged cachevol is not yet possible.");
+               log_warn("WARNING: cache mode writethrough is suggested for safe operation.");
+               if (!arg_count(cmd, yes_ARG) &&
+                   yes_no_prompt("Continue using writeback without repair?") == 'n')
+                       goto_out;
+       }
+
        /*
         * lv/cache_lv keeps the same lockd lock it had before, the lock for
         * lv_fast is freed, and lv_corig has no lock.
This page took 0.050844 seconds and 5 git commands to generate.