master - cleanup: rename vg_ondisk to vg_committed
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d9faf859871e0e...
Commit: d9faf859871e0e862ded3cc08638847c9aaa6f1a
Parent: 0285066e10d0c4a37bc4938eeed2139299600b3e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 24 23:29:18 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Nov 25 11:11:21 2015 +0100
cleanup: rename vg_ondisk to vg_committed
Unifying terminology.
Since all the metadata in-use are ALWAYS on disk - switch
to terminology committed and precommitted.
Patch has no functional change inside.
---
lib/metadata/metadata.c | 16 ++++++++--------
lib/metadata/vg.c | 2 +-
lib/metadata/vg.h | 10 +++++-----
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index b1ddb34..52d76c3 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -936,18 +936,18 @@ static int _vg_update_vg_precommitted(struct volume_group *vg)
return 1;
}
-static int _vg_update_vg_ondisk(struct volume_group *vg)
+static int _vg_update_vg_committed(struct volume_group *vg)
{
if (dm_pool_locked(vg->vgmem))
return 1;
- if (vg->vg_ondisk || is_orphan_vg(vg->name)) /* we already have it */
+ if (vg->vg_committed || is_orphan_vg(vg->name)) /* we already have it */
return 1;
if (!_vg_update_vg_precommitted(vg))
return_0;
- vg->vg_ondisk = vg->vg_precommitted;
+ vg->vg_committed = vg->vg_precommitted;
vg->vg_precommitted = NULL;
if (vg->cft_precommitted) {
dm_config_destroy(vg->cft_precommitted);
@@ -978,7 +978,7 @@ static struct volume_group *_vg_make_handle(struct cmd_context *cmd,
if (vg->read_status != failure)
vg->read_status = failure;
- if (vg->fid && !_vg_update_vg_ondisk(vg))
+ if (vg->fid && !_vg_update_vg_committed(vg))
vg->read_status |= FAILED_ALLOCATION;
return vg;
@@ -3206,8 +3206,8 @@ int vg_commit(struct volume_group *vg)
vg->old_name = NULL;
/* This *is* the original now that it's commited. */
- release_vg(vg->vg_ondisk);
- vg->vg_ondisk = vg->vg_precommitted;
+ release_vg(vg->vg_committed);
+ vg->vg_committed = vg->vg_precommitted;
vg->vg_precommitted = NULL;
if (vg->cft_precommitted) {
dm_config_destroy(vg->cft_precommitted);
@@ -5539,10 +5539,10 @@ const struct logical_volume *lv_ondisk(const struct logical_volume *lv)
if (!lv)
return NULL;
- if (!lv->vg->vg_ondisk)
+ if (!lv->vg->vg_committed)
return lv;
- vg = lv->vg->vg_ondisk;
+ vg = lv->vg->vg_committed;
if (!(found_lv = find_lv_in_vg_by_lvid(vg, &lv->lvid))) {
log_error(INTERNAL_ERROR "LV %s (UUID %s) not found in ondisk metadata.",
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index ca2bf96..992cf2a 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -98,7 +98,7 @@ void release_vg(struct volume_group *vg)
!lvmcache_vginfo_holders_dec_and_test_for_zero(vg->vginfo))
return;
- release_vg(vg->vg_ondisk);
+ release_vg(vg->vg_committed);
release_vg(vg->vg_precommitted);
if (vg->cft_precommitted)
dm_config_destroy(vg->cft_precommitted);
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index a21af8b..df660a7 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -52,13 +52,13 @@ struct volume_group {
unsigned skip_validate_lock_args : 1;
/*
- * The parsed on-disk copy of this VG; is NULL if this is the on-disk
- * version (i.e. vg_ondisk == NULL *implies* this is the on-disk copy,
- * there is no guarantee that if this VG is the same as the on-disk one
+ * The parsed committed (on-disk) copy of this VG; is NULL if this VG is committed
+ * version (i.e. vg_committed == NULL *implies* this is the committed copy,
+ * there is no guarantee that if this VG is the same as the committed one
* this will be NULL). The pointer is maintained by calls to
- * _vg_update_vg_ondisk.
+ * _vg_update_vg_committed.
*/
- struct volume_group *vg_ondisk;
+ struct volume_group *vg_committed;
struct dm_config_tree *cft_precommitted; /* Precommitted metadata */
struct volume_group *vg_precommitted; /* Parsed from cft */
8 years, 5 months
master - thin: fix previous update of partial tree building
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0285066e10d0c4...
Commit: 0285066e10d0c4a37bc4938eeed2139299600b3e
Parent: 8d86c5db03acd0b74cd919f1deb6cbfd1ff86e80
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 24 23:24:11 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 24 23:24:11 2015 +0100
thin: fix previous update of partial tree building
We do want to preserve 'active' thin-pool,
so add this 'fake' layer only when activating.
TODO: think how to use thin-pool without fake LV layer.
---
lib/activate/dev_manager.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index da24cdd..eb47ed1 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2311,7 +2311,8 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
if (seg->pool_lv &&
(lv_is_cache_pool(seg->pool_lv) || !dm->skip_external_lv) &&
- !_add_lv_to_dtree(dm, dtree, seg->pool_lv, origin_only))
+ /* When activating and not origin_only detect linear 'overlay' over pool */
+ !_add_lv_to_dtree(dm, dtree, seg->pool_lv, dm->activation ? origin_only : 1))
return_0;
for (s = 0; s < seg->area_count; s++) {
8 years, 5 months
master - tests: improve teardown
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8d86c5db03acd0...
Commit: 8d86c5db03acd0b74cd919f1deb6cbfd1ff86e80
Parent: a220939d9ef77db63a1f6af5f3798573f047ab03
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 23 23:17:54 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 24 11:29:28 2015 +0100
tests: improve teardown
Do not try to execute vgremove, when test has left suspended devices.
---
test/lib/aux.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 2c66f29..216dd19 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -322,8 +322,12 @@ teardown() {
dm_table | not egrep -q "$vg|$vg1|$vg2|$vg3|$vg4" || {
# Avoid activation of dmeventd if there is no pid
cfg=$(test -s LOCAL_DMEVENTD || echo "--config activation{monitoring=0}")
- vgremove -ff $cfg \
+ if echo "$(dm_info suspended,name)" | grep -q "^Suspended:.*$prefix" ; then
+ echo "Skipping vgremove, suspended devices detected."
+ else
+ vgremove -ff $cfg \
$vg $vg1 $vg2 $vg3 $vg4 &>/dev/null || rm -f debug.log strace.log
+ fi
}
kill_sleep_kill_ LOCAL_LVMPOLLD ${LVM_VALGRIND_LVMPOLLD:-0}
8 years, 5 months
master - tests: data correctness after thin-pool resize
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a220939d9ef77d...
Commit: a220939d9ef77db63a1f6af5f3798573f047ab03
Parent: 9243877ea10f46163506dc64d073d1f24446ab24
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 20 22:28:21 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 24 11:29:27 2015 +0100
tests: data correctness after thin-pool resize
---
test/shell/thin-resize-match.sh | 84 +++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/test/shell/thin-resize-match.sh b/test/shell/thin-resize-match.sh
new file mode 100644
index 0000000..d5481e2
--- /dev/null
+++ b/test/shell/thin-resize-match.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+# Copyright (C) 2015 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# ensure there is no data loss during thin-pool resize
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+test -e LOCAL_LVMPOLLD && skip
+
+which md5sum || skip
+
+aux have_thin 1 0 0 || skip
+
+aux prepare_pvs 2 20
+
+vgcreate -s 512K $vg $(< DEVICES)
+
+lvcreate -L1M -V2M -n $lv1 -T $vg/pool
+
+# just ensure we check what we need to check
+check lv_field $vg/pool size "1.00m"
+check lv_field $vg/$lv1 size "2.00m"
+
+# prepare 2097152 file content
+seq 0 315465 > 2M
+md5sum 2M | cut -f 1 -d ' ' | tee MD5
+dd if=2M of="$DM_DEV_DIR/mapper/$vg-$lv1" bs=512K conv=fdatasync 2>&1 >log &
+#dd if=2M of="$DM_DEV_DIR/mapper/$vg-$lv1" bs=2M oflag=direct &
+
+# give it some time to fill thin-volume
+# eventually loop to wait for 100% full pool...
+sleep .1
+lvs -a $vg
+
+# this must not 'block & wait' on suspending flush
+# if it waits on thin-pool's target timeout
+# it will harm queued data
+lvextend -L+512k $vg/pool
+lvextend -L+512k $vg/pool
+
+# collect 'dd' result
+wait
+cat log
+
+lvs -a $vg
+
+dd if="$DM_DEV_DIR/mapper/$vg-$lv1" of=2M-2 iflag=direct
+md5sum 2M-2 | cut -f 1 -d ' ' | tee MD5-2
+
+# these 2 are supposed to match
+diff MD5 MD5-2
+
+
+# Do not want to see Live & Inactive table entry
+echo $(dm_info attr,name) | not grep "LI-.*${PREFIX}" || {
+ dmsetup table --inactive | grep ${PREFIX}
+ die "Found device with Inactive table"
+}
+
+# Check wrapping active thin-pool linear mapping has matching size
+POOLSZ=$(dmsetup table ${vg}-pool-tpool | cut -d ' ' -f 2)
+WRAPSZ=$(dmsetup table ${vg}-pool | cut -d ' ' -f 2)
+
+#
+# FIXME: currently requires to update 2 dependent targets in one 'preload'
+# lvm2 cannot handle this and would need one extra --refresh pass.
+# Once resolved - enabled this test.
+# Maybe other solution without fake linear mapping could be found.
+# Eventually strictly map just single sector as it has no real use?
+#
+#should test "${POOLSZ}" = "${WRAPSZ}" || \
+# die "Wrapping pool device size does not match real pool size"
+
+vgremove -f $vg
8 years, 5 months
master - cleanup: use display_lvname
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9243877ea10f46...
Commit: 9243877ea10f46163506dc64d073d1f24446ab24
Parent: 5e50e5f0b4074bbeb093f1fba334076be3f59f3f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Nov 22 23:03:01 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 23 23:42:59 2015 +0100
cleanup: use display_lvname
Switch debug msg to use display_lvname.
Link to VG early, so we have access to VG from LV.
---
lib/format_text/import_vsn1.c | 55 +++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index d63192e..879aae7 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -563,6 +563,9 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
if (!(lv = alloc_lv(mem)))
return_0;
+ if (!link_lv_to_vg(vg, lv))
+ return_0;
+
if (!(lv->name = dm_pool_strdup(mem, lvn->key)))
return_0;
@@ -573,7 +576,7 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
if (!_read_flag_config(lvn, &lvstatus, LV_FLAGS)) {
log_error("Couldn't read status flags for logical volume %s.",
- lv->name);
+ display_lvname(lv));
return 0;
}
@@ -586,17 +589,17 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
if (dm_config_has_node(lvn, "creation_time")) {
if (!_read_uint64(lvn, "creation_time", ×tamp)) {
log_error("Invalid creation_time for logical volume %s.",
- lv->name);
+ display_lvname(lv));
return 0;
}
if (!dm_config_get_str(lvn, "creation_host", &hostname)) {
log_error("Couldn't read creation_host for logical volume %s.",
- lv->name);
+ display_lvname(lv));
return 0;
}
} else if (dm_config_has_node(lvn, "creation_host")) {
log_error("Missing creation_time for logical volume %s.",
- lv->name);
+ display_lvname(lv));
return 0;
}
@@ -624,22 +627,22 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
return_0;
}
- lv->alloc = ALLOC_INHERIT;
if (dm_config_get_str(lvn, "allocation_policy", &str)) {
lv->alloc = get_alloc_from_string(str);
if (lv->alloc == ALLOC_INVALID) {
- log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s", str, lv->name);
+ log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s.",
+ str, display_lvname(lv));
lv->alloc = ALLOC_INHERIT;
}
- }
+ } else
+ lv->alloc = ALLOC_INHERIT;
if (dm_config_get_str(lvn, "profile", &str)) {
- log_debug_metadata("Adding profile configuration %s for LV %s/%s.",
- str, vg->name, lv->name);
- lv->profile = add_profile(vg->cmd, str, CONFIG_PROFILE_METADATA);
- if (!lv->profile) {
- log_error("Failed to add configuration profile %s for LV %s/%s",
- str, vg->name, lv->name);
+ log_debug_metadata("Adding profile configuration %s for LV %s.",
+ str, display_lvname(lv));
+ if (!(lv->profile = add_profile(vg->cmd, str, CONFIG_PROFILE_METADATA))) {
+ log_error("Failed to add configuration profile %s for LV %s.",
+ str, display_lvname(lv));
return 0;
}
}
@@ -652,7 +655,7 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
case 0:
lv->read_ahead = DM_READ_AHEAD_AUTO;
break;
- case (uint32_t) -1:
+ case UINT32_C(-1):
lv->read_ahead = DM_READ_AHEAD_NONE;
break;
default:
@@ -663,34 +666,32 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
/* Optional tags */
if (dm_config_get_list(lvn, "tags", &cv) &&
!(_read_str_list(mem, &lv->tags, cv))) {
- log_error("Couldn't read tags for logical volume %s/%s.",
- vg->name, lv->name);
+ log_error("Couldn't read tags for logical volume %s.",
+ display_lvname(lv));
return 0;
}
if (!dm_hash_insert(lv_hash, lv->name, lv))
return_0;
- if (!link_lv_to_vg(vg, lv))
- return_0;
-
if (timestamp && !lv_set_creation(lv, hostname, timestamp))
return_0;
if (!lv_is_visible(lv) && strstr(lv->name, "_pmspare")) {
if (vg->pool_metadata_spare_lv) {
log_error("Couldn't use another pool metadata spare "
- "logical volume %s/%s.", vg->name, lv->name);
+ "logical volume %s.", display_lvname(lv));
return 0;
}
log_debug_metadata("Logical volume %s is pool metadata spare.",
- lv->name);
+ display_lvname(lv));
lv->status |= POOL_METADATA_SPARE;
vg->pool_metadata_spare_lv = lv;
}
if (!lv_is_visible(lv) && !strcmp(lv->name, LOCKD_SANLOCK_LV_NAME)) {
- log_debug_metadata("Logical volume %s is sanlock lv.", lv->name);
+ log_debug_metadata("Logical volume %s is sanlock lv.",
+ display_lvname(lv));
lv->status |= LOCKD_SANLOCK_LV;
vg->sanlock_lv = lv;
}
@@ -721,7 +722,7 @@ static int _read_lvsegs(struct format_instance *fid,
/* FIXME: read full lvid */
if (!_read_id(&lv->lvid.id[1], lvn, "id")) {
log_error("Couldn't read uuid for logical volume %s.",
- lv->name);
+ display_lvname(lv));
return 0;
}
@@ -736,8 +737,8 @@ static int _read_lvsegs(struct format_instance *fid,
if (lv->status & FIXED_MINOR) {
if (!_read_int32(lvn, "minor", &lv->minor)) {
- log_error("Couldn't read minor number for logical "
- "volume %s.", lv->name);
+ log_error("Couldn't read minor number for logical volume %s.",
+ display_lvname(lv));
return 0;
}
@@ -746,13 +747,13 @@ static int _read_lvsegs(struct format_instance *fid,
lv->major = vg->cmd->dev_types->device_mapper_major;
else if (!_read_int32(lvn, "major", &lv->major)) {
log_warn("WARNING: Couldn't read major number for logical "
- "volume %s.", lv->name);
+ "volume %s.", display_lvname(lv));
lv->major = vg->cmd->dev_types->device_mapper_major;
}
if (!validate_major_minor(vg->cmd, fid->fmt, lv->major, lv->minor)) {
log_warn("WARNING: Ignoring invalid major, minor number for "
- "logical volume %s.", lv->name);
+ "logical volume %s.", display_lvname(lv));
lv->major = lv->minor = -1;
}
}
8 years, 5 months
master - thin: skip detach preload from pools
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e50e5f0b4074b...
Commit: 5e50e5f0b4074bbeb093f1fba334076be3f59f3f
Parent: 6d6c233768e2a9c3bd9fd13e113e2a890c18b2cf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Nov 22 23:04:11 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 23 23:42:59 2015 +0100
thin: skip detach preload from pools
lv preload for detached LVs started to be used also
for various other types which just happens to pass through
weak if() condition.
TODO: find here better solution to rather explicitly check
for types we really need to preload.
---
lib/activate/activate.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 6a6a952..c30a7ac 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1778,8 +1778,11 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
return_0;
}
+ /* FIXME: condition here should be far more limiting to really
+ * detect detached LVs */
if ((lv_pre = find_lv(detached->lv_pre->vg, lv->name))) {
if (lv_is_visible(lv_pre) && lv_is_active(lv) &&
+ !lv_is_pool(lv) &&
(!lv_is_cow(lv) || !lv_is_cow(lv_pre)) &&
!_lv_preload(lv_pre, detached->laopts, detached->flush_required))
return_0;
8 years, 5 months
master - cleanup: move towards using direct LV pointers
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d6c233768e2a9...
Commit: 6d6c233768e2a9c3bd9fd13e113e2a890c18b2cf
Parent: 94c9453659e9e2ec0389b8ea3e9ed18718d61d6a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 21 23:31:44 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 23 23:42:59 2015 +0100
cleanup: move towards using direct LV pointers
We do not won't to 'expose' internals of VG struct.
ATM we use lists to keep all LVs - we may want to switch
to better struct for quicker 'search'.
Since we do not need 'lists' but always actual LV,
switch find_lv_in_vg_by_lvid() to return LV,
and replaces some use case of find_lv_in_vg()
with 'better' working find_lv() which already
returns LV.
---
lib/activate/activate.c | 38 +++++++++++++++++++-------------------
lib/metadata/metadata.c | 18 +++++++++---------
lib/metadata/metadata.h | 4 ++--
3 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 7d2adf1..6a6a952 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1763,25 +1763,25 @@ struct detached_lv_data {
static int _preload_detached_lv(struct logical_volume *lv, void *data)
{
struct detached_lv_data *detached = data;
- struct lv_list *lvl_pre;
+ struct logical_volume *lv_pre;
/* Check and preload removed raid image leg or metadata */
if (lv_is_raid_image(lv)) {
- if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
- !lv_is_raid_image(lvl_pre->lv) && lv_is_active(lv) &&
- !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
+ if ((lv_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
+ !lv_is_raid_image(lv_pre) && lv_is_active(lv) &&
+ !_lv_preload(lv_pre, detached->laopts, detached->flush_required))
return_0;
} else if (lv_is_raid_metadata(lv)) {
- if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
- !lv_is_raid_metadata(lvl_pre->lv) && lv_is_active(lv) &&
- !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
+ if ((lv_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
+ !lv_is_raid_metadata(lv_pre) && lv_is_active(lv) &&
+ !_lv_preload(lv_pre, detached->laopts, detached->flush_required))
return_0;
}
- if ((lvl_pre = find_lv_in_vg(detached->lv_pre->vg, lv->name))) {
- if (lv_is_visible(lvl_pre->lv) && lv_is_active(lv) &&
- (!lv_is_cow(lv) || !lv_is_cow(lvl_pre->lv)) &&
- !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
+ if ((lv_pre = find_lv(detached->lv_pre->vg, lv->name))) {
+ if (lv_is_visible(lv_pre) && lv_is_active(lv) &&
+ (!lv_is_cow(lv) || !lv_is_cow(lv_pre)) &&
+ !_lv_preload(lv_pre, detached->laopts, detached->flush_required))
return_0;
}
@@ -1795,7 +1795,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
const struct logical_volume *pvmove_lv = NULL;
const struct logical_volume *ondisk_lv_to_free = NULL;
const struct logical_volume *incore_lv_to_free = NULL;
- struct lv_list *lvl_pre;
+ struct logical_volume *lv_pre;
struct seg_list *sl;
struct lv_segment *snap_seg;
struct lvinfo info;
@@ -1854,19 +1854,19 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
(pvmove_lv = find_pvmove_lv_in_lv(ondisk_lv))) {
/* Preload all the LVs above the PVMOVE LV */
dm_list_iterate_items(sl, &pvmove_lv->segs_using_this_lv) {
- if (!(lvl_pre = find_lv_in_vg(incore_lv->vg, sl->seg->lv->name))) {
+ if (!(lv_pre = find_lv(incore_lv->vg, sl->seg->lv->name))) {
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", sl->seg->lv->name);
goto out;
}
- if (!_lv_preload(lvl_pre->lv, laopts, &flush_required))
+ if (!_lv_preload(lv_pre, laopts, &flush_required))
goto_out;
}
/* Now preload the PVMOVE LV itself */
- if (!(lvl_pre = find_lv_in_vg(incore_lv->vg, pvmove_lv->name))) {
+ if (!(lv_pre = find_lv(incore_lv->vg, pvmove_lv->name))) {
log_error(INTERNAL_ERROR "LV %s missing from preload metadata", pvmove_lv->name);
goto out;
}
- if (!_lv_preload(lvl_pre->lv, laopts, &flush_required))
+ if (!_lv_preload(lv_pre, laopts, &flush_required))
goto_out;
} else {
if (!_lv_preload(incore_lv, laopts, &flush_required))
@@ -1888,13 +1888,13 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
*/
if (!laopts->origin_only && lv_is_origin(ondisk_lv)) {
dm_list_iterate_items_gen(snap_seg, &ondisk_lv->snapshot_segs, origin_list) {
- if (!(lvl_pre = find_lv_in_vg_by_lvid(incore_lv->vg, &snap_seg->cow->lvid))) {
+ if (!(lv_pre = find_lv_in_vg_by_lvid(incore_lv->vg, &snap_seg->cow->lvid))) {
log_error(INTERNAL_ERROR "LV %s (%s) missing from preload metadata",
snap_seg->cow->name, snap_seg->cow->lvid.id[1].uuid);
goto out;
}
- if (!lv_is_cow(lvl_pre->lv) &&
- !_lv_preload(lvl_pre->lv, laopts, &flush_required))
+ if (!lv_is_cow(lv_pre) &&
+ !_lv_preload(lv_pre, laopts, &flush_required))
goto_out;
}
}
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 77bbeab..b1ddb34 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1975,14 +1975,14 @@ struct lv_list *find_lv_in_lv_list(const struct dm_list *ll,
return NULL;
}
-struct lv_list *find_lv_in_vg_by_lvid(struct volume_group *vg,
- const union lvid *lvid)
+struct logical_volume *find_lv_in_vg_by_lvid(struct volume_group *vg,
+ const union lvid *lvid)
{
struct lv_list *lvl;
dm_list_iterate_items(lvl, &vg->lvs)
if (!strncmp(lvl->lv->lvid.s, lvid->s, sizeof(*lvid)))
- return lvl;
+ return lvl->lv;
return NULL;
}
@@ -4134,7 +4134,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
struct logical_volume *lv_from_lvid(struct cmd_context *cmd, const char *lvid_s,
unsigned precommitted)
{
- struct lv_list *lvl;
+ struct logical_volume *lv;
struct volume_group *vg;
const union lvid *lvid;
@@ -4151,12 +4151,12 @@ struct logical_volume *lv_from_lvid(struct cmd_context *cmd, const char *lvid_s,
log_error("Volume group \"%s\" is exported", vg->name);
goto out;
}
- if (!(lvl = find_lv_in_vg_by_lvid(vg, lvid))) {
+ if (!(lv = find_lv_in_vg_by_lvid(vg, lvid))) {
log_very_verbose("Can't find logical volume id %s", lvid_s);
goto out;
}
- return lvl->lv;
+ return lv;
out:
release_vg(vg);
return NULL;
@@ -5534,7 +5534,7 @@ char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl)
const struct logical_volume *lv_ondisk(const struct logical_volume *lv)
{
struct volume_group *vg;
- struct lv_list *lvl;
+ struct logical_volume *found_lv;
if (!lv)
return NULL;
@@ -5544,13 +5544,13 @@ const struct logical_volume *lv_ondisk(const struct logical_volume *lv)
vg = lv->vg->vg_ondisk;
- if (!(lvl = find_lv_in_vg_by_lvid(vg, &lv->lvid))) {
+ if (!(found_lv = find_lv_in_vg_by_lvid(vg, &lv->lvid))) {
log_error(INTERNAL_ERROR "LV %s (UUID %s) not found in ondisk metadata.",
display_lvname(lv), lv->lvid.s);
return NULL;
}
- return lvl->lv;
+ return found_lv;
}
/*
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index 1a5306b..e19bd16 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -364,8 +364,8 @@ int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
const char *vgid, const char *pvid,
struct physical_volume *pv);
-struct lv_list *find_lv_in_vg_by_lvid(struct volume_group *vg,
- const union lvid *lvid);
+struct logical_volume *find_lv_in_vg_by_lvid(struct volume_group *vg,
+ const union lvid *lvid);
struct lv_list *find_lv_in_lv_list(const struct dm_list *ll,
const struct logical_volume *lv);
8 years, 5 months
master - thin: work with active thin-pool
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=94c9453659e9e2...
Commit: 94c9453659e9e2ec0389b8ea3e9ed18718d61d6a
Parent: 15be97d76b0ca24d62c67a947ae595a2124260be
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 23 19:53:43 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 23 23:41:36 2015 +0100
thin: work with active thin-pool
When 'lvextend -L+XX vg/thinpool' do not leave inactive table
loaded for 'wrapping' LV on top of resized thin-pool
(ATM we use linear LV for this with same size as thin-pool).
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0b24981..a4eeebf 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.136 -
=====================================
+ Fix inactive table loaded for wrapping thin-pool when resizing it.
Extend the list of ignored libraries when locking memory.
Version 2.02.135 - 23rd November 2015
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index fd4d842..da24cdd 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2311,7 +2311,7 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
if (seg->pool_lv &&
(lv_is_cache_pool(seg->pool_lv) || !dm->skip_external_lv) &&
- !_add_lv_to_dtree(dm, dtree, seg->pool_lv, 1)) /* stack */
+ !_add_lv_to_dtree(dm, dtree, seg->pool_lv, origin_only))
return_0;
for (s = 0; s < seg->area_count; s++) {
8 years, 5 months
master - memlock: add more libs on ignore list
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=15be97d76b0ca2...
Commit: 15be97d76b0ca24d62c67a947ae595a2124260be
Parent: 6ca5447e0c65ba6126a005aafeff3dc5c340bb75
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Nov 22 00:26:06 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 23 23:39:01 2015 +0100
memlock: add more libs on ignore list
Udev recently start to 'link-in' major amount of useless libs.
(Seem to be faulty 'systemd' link-in all issue)
Anyway - avoid locking those libs in RAM.
---
WHATS_NEW | 1 +
lib/mm/memlock.c | 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f247487..0b24981 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.136 -
=====================================
+ Extend the list of ignored libraries when locking memory.
Version 2.02.135 - 23rd November 2015
=====================================
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index c17ae13..969f1d7 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -97,17 +97,25 @@ static const char * const _blacklist_maps[] = {
"locale/locale-archive",
"/LC_MESSAGES/",
"gconv/gconv-modules.cache",
+ "/ld-2.", /* not using dlopen,dlsym during mlock */
+ "/libattr.so.", /* not using during mlock (udev) */
"/libblkid.so.", /* not using lzma during mlock (selinux) */
+ "/libbz2.so.", /* not using during mlock (udev) */
+ "/libcap.so.", /* not using during mlock (udev) */
+ "/libdw-", /* not using during mlock (udev) */
+ "/libelf-", /* not using during mlock (udev) */
"/liblzma.so.", /* not using lzma during mlock (selinux) */
"/libncurses.so.", /* not using ncurses during mlock */
"/libpcre.so.", /* not using pcre during mlock (selinux) */
"/libreadline.so.", /* not using readline during mlock */
+ "/libresolv-", /* not using during mlock (udev) */
"/libselinux.so.", /* not using selinux during mlock */
"/libsepol.so.", /* not using sepol during mlock */
"/libtinfo.so.", /* not using tinfo during mlock */
"/libudev.so.", /* not using udev during mlock */
"/libuuid.so.", /* not using uuid during mlock (blkid) */
"/libdl-", /* not using dlopen,dlsym during mlock */
+ "/libz.so.", /* not using during mlock (udev) */
"/etc/selinux", /* not using selinux during mlock */
/* "/libdevmapper-event.so" */
};
8 years, 5 months
master - libdm: enhance thin-pool preload
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6ca5447e0c65ba...
Commit: 6ca5447e0c65ba6126a005aafeff3dc5c340bb75
Parent: ddbf0075b1abb5ea0cb0ff56cc128fd18523ed36
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 23 23:15:04 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 23 23:34:46 2015 +0100
libdm: enhance thin-pool preload
When preloading thin-pool device node for already
existing/running thin-pool do not resume such thin-pool.
This allows to properly schedule commit point for metadata,
when thin-pool data or metadata volume is resized.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 49aa50f..600c5b7 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.112 -
=====================================
+ Improve preloading sequence of an active thin-pool target.
Drop extra space from cache target line to fix unneded table reloads.
Version 1.02.111 - 23rd November 2015
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 830a6a8..0b33ad3 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2788,6 +2788,7 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
struct dm_tree_node *child;
struct dm_info newinfo;
int update_devs_flag = 0;
+ struct load_segment *seg;
/* Preload children first */
while ((child = dm_tree_next_child(&handle, dnode, 0))) {
@@ -2835,6 +2836,22 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
if (!dm_tree_node_num_children(child, 1) || !child->props.size_changed)
continue;
+ if (!node_created && (dm_list_size(&child->props.segs) == 1)) {
+ /* If thin-pool child nodes were preloaded WITH changed size
+ * skip device resume, as this is likely resize of data or
+ * metadata device and so thin pool needs suspend before
+ * resume operation.
+ * Note: child->props.segment_count is already 0 here
+ */
+ seg = dm_list_item(dm_list_last(&child->props.segs),
+ struct load_segment);
+ if (seg->type == SEG_THIN_POOL) {
+ log_debug_activation("Skipping resume of thin-pool %s.",
+ child->name);
+ continue;
+ }
+ }
+
if (!child->info.inactive_table && !child->info.suspended)
continue;
8 years, 5 months