master - tests: flushing of cache is abortable
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cb2c2484b976e0ea468...
Commit: cb2c2484b976e0ea4684cdf4ec26ab6adadce024
Parent: 7d5afcc0cb968ed73a6c793fd98e8d377cafe473
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 20:09:00 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:17:20 2017 +0200
tests: flushing of cache is abortable
---
test/shell/lvconvert-cache-abort.sh | 54 +++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-cache-abort.sh b/test/shell/lvconvert-cache-abort.sh
new file mode 100644
index 0000000..899fa42
--- /dev/null
+++ b/test/shell/lvconvert-cache-abort.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Copyright (C) 2014-2016 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Exercise cache flushing is abortable
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux have_cache 1 3 0 || skip
+
+aux prepare_vg 2
+
+# Data device on later delayed dev1
+lvcreate -L4 -n cpool $vg "$dev1"
+lvconvert -y --type cache-pool $vg/cpool "$dev2"
+lvcreate -H -L 4 -n $lv1 --chunksize 32k --cachemode writeback --cachepool $vg/cpool $vg "$dev2"
+
+#
+# Ensure cache gets promoted blocks
+#
+for i in $(seq 1 10) ; do
+echo 3 >/proc/sys/vm/drop_caches
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=64K count=20 conv=fdatasync || true
+echo 3 >/proc/sys/vm/drop_caches
+dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=64K count=20 || true
+done
+
+
+# Delay dev to ensure we have some time to 'capture' interrupt in flush
+aux delay_dev "$dev1" 0 500 $(get first_extent_sector "$dev1"):
+
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=4k count=100 conv=fdatasync
+
+LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -v --splitcache $vg/$lv1 >log 2>&1 &
+PID_CONVERT=$!
+sleep 0.1
+kill -INT $PID_CONVERT
+aux enable_dev "$dev1"
+wait
+egrep "Flushing.*aborted" log
+# check the table got restored
+check grep_dmsetup table $vg-$lv1 "writeback"
+
+vgremove -f $vg
6 years, 11 months
master - tests: check lvdisplay for cache works
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7d5afcc0cb968ed73a6...
Commit: 7d5afcc0cb968ed73a6c793fd98e8d377cafe473
Parent: 41c10034aa0db3c63f18ff78b64af3a799c154a1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 20:08:24 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:17:20 2017 +0200
tests: check lvdisplay for cache works
---
test/shell/lvcreate-cache.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvcreate-cache.sh b/test/shell/lvcreate-cache.sh
index 410e105..f19965a 100644
--- a/test/shell/lvcreate-cache.sh
+++ b/test/shell/lvcreate-cache.sh
@@ -251,6 +251,8 @@ fail lvcreate --type cache-pool -l1 --chunksize 1G $vg/cpool3
lvcreate --type cache-pool -L10 $vg/cpool4
fail lvcreate -H -L10 --chunksize 16M $vg/cpool4
+lvdisplay --maps $vg
+
lvremove -f $vg
lvcreate --type cache-pool -L10 $vg/cpool
6 years, 11 months
master - debug: show message only when origin_only was set
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=41c10034aa0db3c63f1...
Commit: 41c10034aa0db3c63f18ff78b64af3a799c154a1
Parent: 58e075f5fb12d8bce4ebb1c19c9f20b10d984e57
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 17:14:47 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:17:20 2017 +0200
debug: show message only when origin_only was set
---
lib/metadata/lv_manip.c | 2 +-
lib/metadata/raid_manip.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index c431868..1a584f2 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6372,7 +6372,7 @@ static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
if (!vg_write(vg))
return_0;
- if (lock_lv != lv) {
+ if (origin_only && (lock_lv != lv)) {
log_debug_activation("Dropping origin_only for %s as lock holds %s",
display_lvname(lv), display_lvname(lock_lv));
origin_only = 0;
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 66fc2bd..08347f9 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -557,7 +557,7 @@ static int _lv_update_reload_fns_reset_eliminate_lvs(struct logical_volume *lv,
va_start(ap, origin_only);
removal_lvs = va_arg(ap, struct dm_list *);
- if (lock_lv != lv) {
+ if (origin_only && (lock_lv != lv)) {
log_debug_activation("Dropping origin_only for %s as lock holds %s",
display_lvname(lv), display_lvname(lock_lv));
origin_only = 0;
@@ -649,7 +649,7 @@ static int _lv_update_and_reload_list(struct logical_volume *lv, int origin_only
struct lv_list *lvl;
int r;
- if (lock_lv != lv) {
+ if (origin_only && (lock_lv != lv)) {
log_debug_activation("Dropping origin_only for %s as lock holds %s",
display_lvname(lv), display_lvname(lock_lv));
origin_only = 0;
@@ -2120,7 +2120,7 @@ static int _vg_write_lv_suspend_commit_backup(struct volume_group *vg,
const struct logical_volume *lock_lv = lv_lock_holder(lv);
int r = 1;
- if (lock_lv != lv) {
+ if (origin_only && (lock_lv != lv)) {
log_debug_activation("Dropping origin_only for %s as lock holds %s",
display_lvname(lv), display_lvname(lock_lv));
origin_only = 0;
6 years, 11 months
master - cache: fix lvdisplay output
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=58e075f5fb12d8bce4e...
Commit: 58e075f5fb12d8bce4ebb1c19c9f20b10d984e57
Parent: 732928dda8eaf20ab2375e27ae641d58db08b8f4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 20:05:26 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:17:18 2017 +0200
cache: fix lvdisplay output
Unused cache pool may have lots of fields actually undefined,
so avoid printing them, if they are not specified in metadata.
---
WHATS_NEW | 1 +
lib/cache_segtype/cache.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 12368dd..f1f354d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Do not lvdisplay --maps unset settings of cache pool.
Fix lvdisplay --maps for cache pool without policy settings.
Avoid using origin_only manipulation with cached device.
Support aborting of flushing cache LV.
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 7461b21..26f3e32 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -51,9 +51,15 @@ static void _cache_display(const struct lv_segment *seg)
log_print(" Chunk size\t\t%s",
display_size(seg->lv->vg->cmd, pool_seg->chunk_size));
- log_print(" Metadata format\t%u", pool_seg->cache_metadata_format);
- log_print(" Mode\t\t%s", get_cache_mode_name(pool_seg));
- log_print(" Policy\t\t%s", pool_seg->policy_name);
+
+ if (pool_seg->cache_metadata_format != CACHE_METADATA_FORMAT_UNSELECTED)
+ log_print(" Metadata format\t%u", pool_seg->cache_metadata_format);
+
+ if (pool_seg->cache_mode != CACHE_MODE_UNSELECTED)
+ log_print(" Mode\t\t%s", get_cache_mode_name(pool_seg));
+
+ if (pool_seg->policy_name)
+ log_print(" Policy\t\t%s", pool_seg->policy_name);
if (pool_seg->policy_settings &&
(n = pool_seg->policy_settings->child))
6 years, 11 months
master - cache: fix lvdisplay --maps
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=732928dda8eaf20ab23...
Commit: 732928dda8eaf20ab2375e27ae641d58db08b8f4
Parent: 58a9f88b8c021a5e056b883053f257f1a898adf7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 19:53:27 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:15:12 2017 +0200
cache: fix lvdisplay --maps
'lvdisplay -m' tried to go through NULL policy settings,
when such policy was not defined for CachedLV.
Patch is fixing display of cache-pool without defined settings,
as this is now a valid pool and we mostly want users to define
these settings when actually really caching a LV.
---
WHATS_NEW | 1 +
lib/cache_segtype/cache.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2f1ec8a..12368dd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Fix lvdisplay --maps for cache pool without policy settings.
Avoid using origin_only manipulation with cached device.
Support aborting of flushing cache LV.
Reenable conversion of data and metadata thin-pool volumes to raid.
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index da23dae..7461b21 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -55,7 +55,8 @@ static void _cache_display(const struct lv_segment *seg)
log_print(" Mode\t\t%s", get_cache_mode_name(pool_seg));
log_print(" Policy\t\t%s", pool_seg->policy_name);
- if ((n = pool_seg->policy_settings->child))
+ if (pool_seg->policy_settings &&
+ (n = pool_seg->policy_settings->child))
dm_config_write_node(n, _cache_out_line, NULL);
log_print(" ");
6 years, 11 months
master - cache: drop usage of origin_only
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=58a9f88b8c021a5e056...
Commit: 58a9f88b8c021a5e056b883053f257f1a898adf7
Parent: ca9e6cec619e242fe6283fc5acbf773f763c1f5a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 17:12:27 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:14:31 2017 +0200
cache: drop usage of origin_only
Since cache LV can be a stacked device, there is no real reason
trying to use slight optimised tree for origin_only cache reload
(it could be even wrongly implemented in this case).
We can easily go with stardard tree load here.
---
WHATS_NEW | 1 +
lib/metadata/cache_manip.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 25571cc..2f1ec8a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Avoid using origin_only manipulation with cached device.
Support aborting of flushing cache LV.
Reenable conversion of data and metadata thin-pool volumes to raid.
Improve raid status reporting with lvs.
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index cc3482b..057d043 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -485,7 +485,7 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
/* Switch to cleaner policy to flush the cache */
cache_seg->cleaner_policy = 1;
/* Reload cache volume with "cleaner" policy */
- if (!lv_update_and_reload_origin(cache_lv))
+ if (!lv_update_and_reload(cache_lv))
return_0;
if (!sync_local_dev_names(cache_lv->vg->cmd)) {
6 years, 11 months
master - cache: make syncing abortable by user
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ca9e6cec619e242fe62...
Commit: ca9e6cec619e242fe6283fc5acbf773f763c1f5a
Parent: 2df9a786845af2ce34cb3942dc2b16342e359a2c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 22 17:08:47 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 22 20:11:43 2017 +0200
cache: make syncing abortable by user
When user runs command like 'lvconvert --splitcache' the operation
might be actually either slow or not making any progress in kernel,
so lets give user a chance to abort such operation.
When user press 'Ctrl+C' device table is restored to pre-flushing state.
---
WHATS_NEW | 1 +
lib/metadata/cache_manip.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e60380a..25571cc 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Support aborting of flushing cache LV.
Reenable conversion of data and metadata thin-pool volumes to raid.
Improve raid status reporting with lvs.
No longer necessary to '--force' a repair for RAID1
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index e7da899..cc3482b 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -22,6 +22,7 @@
#include "activate.h"
#include "defaults.h"
#include "lv_alloc.h"
+#include "lvm-signal.h"
/* https://github.com/jthornber/thin-provisioning-tools/blob/master/caching/... */
#define DM_TRANSACTION_OVERHEAD 4096 /* KiB */
@@ -431,6 +432,20 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
//FIXME: use polling to do this...
for (;;) {
+ sigint_allow();
+ sigint_restore();
+ if (sigint_caught()) {
+ sigint_clear();
+ log_error("Flushing of %s aborted.", display_lvname(cache_lv));
+ if (cache_seg->cleaner_policy) {
+ cache_seg->cleaner_policy = 0;
+ /* Restore normal table */
+ if (!lv_update_and_reload(cache_lv))
+ stack;
+ }
+ return 0;
+ }
+
if (!lv_cache_status(cache_lv, &status))
return_0;
@@ -452,9 +467,12 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
log_print_unless_silent("Flushing " FMTu64 " blocks for cache %s.",
dirty_blocks, display_lvname(cache_lv));
+
if (cleaner_policy) {
/* TODO: Use centralized place */
+ sigint_allow();
usleep(500000);
+ sigint_restore();
continue;
}
6 years, 11 months
master - mirror: reformat conditional
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2df9a786845af2ce34c...
Commit: 2df9a786845af2ce34cb3942dc2b16342e359a2c
Parent: 64fac77e8a551f4dfe8f4cfaaf1ca984c9b5146c
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Jun 22 00:57:16 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Jun 22 00:57:16 2017 +0200
mirror: reformat conditional
---
lib/metadata/mirror.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 9dee0ab..52e1488 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1459,7 +1459,8 @@ int remove_mirrors_from_segments(struct logical_volume *lv,
log_error("Segment is not mirrored: %s:%" PRIu32,
lv->name, seg->le);
return 0;
- } if ((seg->status & status_mask) != status_mask) {
+ }
+ if ((seg->status & status_mask) != status_mask) {
log_error("Segment status does not match: %s:%" PRIu32
" status:0x%" PRIx64 "/0x%" PRIx64, lv->name, seg->le,
seg->status, status_mask);
6 years, 11 months
master - raid: fix segfault
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=64fac77e8a551f4dfe8...
Commit: 64fac77e8a551f4dfe8f4cfaaf1ca984c9b5146c
Parent: 93fbfa2ed397d7b87d4088e19303748c242f24d1
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Jun 22 00:49:00 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Jun 22 00:49:00 2017 +0200
raid: fix segfault
Add missing else clause
(already missing in initial commit fe18e5e77a488618510648c7801ea3375ce5aac4).
Resolves: rhbz1463794
---
lib/metadata/raid_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 9e4f3a3..66fc2bd 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2373,7 +2373,7 @@ static int _raid_reshape(struct logical_volume *lv,
if (seg->area_count != 2 || old_image_count != seg->area_count) {
if (!_lv_update_reload_fns_reset_eliminate_lvs(lv, 0, &removal_lvs, NULL))
return_0;
- } if (!_vg_write_commit_backup(lv->vg))
+ } else if (!_vg_write_commit_backup(lv->vg))
return_0;
return 1;
6 years, 11 months
master - tests: lvresize needs --yes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=93fbfa2ed397d7b87d4...
Commit: 93fbfa2ed397d7b87d4088e19303748c242f24d1
Parent: e3f63693a4ea76975fb01f8456f1f263b029b07f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 21 13:58:55 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 21 14:03:29 2017 +0200
tests: lvresize needs --yes
---
test/shell/fsadm.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/test/shell/fsadm.sh b/test/shell/fsadm.sh
index ac43900..6eff24a 100644
--- a/test/shell/fsadm.sh
+++ b/test/shell/fsadm.sh
@@ -131,6 +131,7 @@ if check_missing ext3; then
not fsadm -y --lvresize resize $vg_lv 4M
echo n | not lvresize -L4M -r -n $vg_lv
lvresize -L+20M -r -n $vg_lv
+ lvresize -L-10M -r -y $vg_lv
umount "$mount_dir"
umount "$mount_space_dir"
fscheck_ext3
6 years, 11 months