master - tests: use bigger raid size
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=59b0bd7b6445d0...
Commit: 59b0bd7b6445d0c09568eae4cbf75577ce190803
Parent: 88c19d5d7200b4193693f88f42e05646a52b4563
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 18 23:09:17 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 23:09:17 2016 +0200
tests: use bigger raid size
To avoid problem with report of array in-sync use for now bigger
raid size 64M.
---
test/shell/lvconvert-repair-raid.sh | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-repair-raid.sh b/test/shell/lvconvert-repair-raid.sh
index 41d1cb9..1ef91c4 100644
--- a/test/shell/lvconvert-repair-raid.sh
+++ b/test/shell/lvconvert-repair-raid.sh
@@ -22,8 +22,12 @@ aux lvmconf 'allocation/maximise_cling = 0' \
aux prepare_vg 8
+# It's possible small raid arrays do have problems with reporting in-sync.
+# So try bigger size
+RAID_SIZE=64
+
# RAID5 single replace
-lvcreate --type raid5 -i 2 -l 2 -n $lv1 $vg "$dev1" "$dev2" "$dev3"
+lvcreate --type raid5 -i 2 -L $RAID_SIZE -n $lv1 $vg "$dev1" "$dev2" "$dev3"
aux wait_for_sync $vg $lv1
aux disable_dev "$dev3"
lvconvert -y --repair $vg/$lv1
@@ -33,7 +37,7 @@ vgextend $vg "$dev3"
lvremove -ff $vg
# RAID6 double replace
-lvcreate --type raid6 -i 3 -l 2 -n $lv1 $vg \
+lvcreate --type raid6 -i 3 -L $RAID_SIZE -n $lv1 $vg \
"$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
aux wait_for_sync $vg $lv1
aux disable_dev "$dev4" "$dev5"
7 years, 1 month
master - lvchange: improve refresh for merging thin volume
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88c19d5d7200b4...
Commit: 88c19d5d7200b4193693f88f42e05646a52b4563
Parent: 7e5881dd131e6f521f8f419edc3bb42e575d693a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 18 22:44:30 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 23:05:51 2016 +0200
lvchange: improve refresh for merging thin volume
When running lvchange --refresh on merging thin volume,
try to deactivate snapshot thinLV in case it's preventing
startup of merge process.
---
WHATS_NEW | 1 +
tools/toollib.c | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 863fe30..4a435bb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.151 -
=================================
+ lvchange --refresh for merging thin origin will retry to deactivate snapshot.
Recognize in-progress snapshot merge for thin volumes from dm table.
Avoid deciding to initiate a pending snapshot merge during resume.
Improve retrying lvmetad requests while lvmetad is being updated.
diff --git a/tools/toollib.c b/tools/toollib.c
index 5e9b4d8..b9db9cb 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1080,6 +1080,16 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
{
+ struct logical_volume *snapshot_lv;
+
+ if (lv_is_merging_origin(lv)) {
+ snapshot_lv = find_snapshot(lv)->lv;
+ if (lv_is_thin_type(snapshot_lv) && !deactivate_lv(cmd, snapshot_lv))
+ log_print_unless_silent("Delaying merge for origin volume %s since "
+ "snapshot volume %s is still active.",
+ display_lvname(lv), display_lvname(snapshot_lv));
+ }
+
if (!lv_refresh_suspend_resume(cmd, lv))
return_0;
7 years, 1 month
master - snapshot: improve merge
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7e5881dd131e6f...
Commit: 7e5881dd131e6f521f8f419edc3bb42e575d693a
Parent: d1c1f60047bb6973eee432ea14f93058a836faac
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 18 22:54:27 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 23:05:17 2016 +0200
snapshot: improve merge
Improve code for snapshot merge for readabilty
and also reduce number of tests needed to decide
if merging can or cannot be started.
(Further improving 9cccf5245a97a64f900f253fcf948edd5d7ba8c0)
---
lib/activate/dev_manager.c | 77 +++++++++++++++++++++-----------------------
1 files changed, 37 insertions(+), 40 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index b155039..5b1e226 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2741,7 +2741,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
uint32_t read_ahead = lv->read_ahead;
uint32_t read_ahead_flags = UINT32_C(0);
int save_pending_delete = dm->track_pending_delete;
- int snap_dev_is_open = 0;
+ int merge_in_progress = 0;
/* LV with pending delete is never put new into a table */
if (lv_is_pending_delete(lv) && !_cached_dm_info(dm->mem, dtree, lv, NULL))
@@ -2762,57 +2762,52 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!layer && lv_is_merging_origin(lv)) {
seg = find_snapshot(lv);
/*
- * Clear merge attributes if merge isn't currently possible:
+ * Prevent merge if merge isn't currently possible:
* either origin or merging snapshot are open
* - for old snaps use "snapshot-merge" if it is already in use
* - open_count is always retrieved (as of dm-ioctl 4.7.0)
* so just use the tree's existing nodes' info
*/
- if ((dinfo = _cached_dm_info(dm->mem, dtree,
+ if ((dinfo = _cached_dm_info(dm->mem, dtree, lv, NULL))) {
+ /* Merging origin LV is present, check if mergins is already running. */
+ if ((seg_is_thin_volume(seg) && _thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id)) ||
+ (!seg_is_thin_volume(seg) && lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
+ log_debug_activation("Merging of snapshot volume %s to origin %s is in progress.",
+ display_lvname(seg->lv), display_lvname(seg->lv));
+ merge_in_progress = 1; /* Merge is already running */
+ } /* Merge is not yet running, so check if it can be started */
+ else if (laopts->resuming) {
+ log_debug_activation("Postponing pending snapshot merge for origin %s, "
+ "merge was not started before suspend.",
+ display_lvname(lv));
+ laopts->no_merging = 1; /* Cannot be reloaded in suspend */
+ } /* Non-resuming merge requires origin to be unused */
+ else if (dinfo->open_count) {
+ log_debug_activation("Postponing pending snapshot merge for origin %s, "
+ "origin volume is opened.",
+ display_lvname(lv));
+ laopts->no_merging = 1;
+ }
+ }
+
+ /* If merge would be still undecided, look as snapshot */
+ if (!merge_in_progress && !laopts->no_merging &&
+ (dinfo = _cached_dm_info(dm->mem, dtree,
seg_is_thin_volume(seg) ?
seg->lv : seg->cow, NULL))) {
if (seg_is_thin_volume(seg)) {
/* Active thin snapshot prevents merge */
- log_debug_activation("Merging thin snapshot %s is active.",
- display_lvname(seg->lv));
+ log_debug_activation("Postponing pending snapshot merge for origin volume %s, "
+ "merging thin snapshot volume %s is active.",
+ display_lvname(lv), display_lvname(seg->lv));
+ laopts->no_merging = 1;
} else if (dinfo->open_count) {
- log_debug_activation("Merging snapshot LV %s is openned.",
- display_lvname(seg->lv));
- snap_dev_is_open = 1;
+ log_debug_activation("Postponing pending snapshot merge for origin volume %s, "
+ "merging snapshot volume %s is opened.",
+ display_lvname(lv), display_lvname(seg->lv));
+ laopts->no_merging = 1;
}
}
-
- if ((dinfo = _cached_dm_info(dm->mem, dtree, lv, NULL))) {
- if (dinfo->open_count) {
- log_debug_activation("Merging origin volume %s is openned.", display_lvname(seg->lv));
- snap_dev_is_open = 1;
- }
-
- /* Check if decision needs to be preserved.
- * Merging origin LV needs to be present in table in this case. */
- if (!laopts->resuming) {
- if ((seg_is_thin_volume(seg) && _thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id)) ||
- (!seg_is_thin_volume(seg) && lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
- log_debug_activation("Merging of snapshot volume %s is in progress.",
- display_lvname(seg->lv));
- /* Merging is already running and cannot be switched */
- snap_dev_is_open = 0;
- }
- } else {
- if ((seg_is_thin_volume(seg) && !_thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id)) ||
- (!seg_is_thin_volume(seg) && !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
- log_debug_activation("Merging of snapshot volume %s was not started before suspend.",
- display_lvname(seg->lv));
- /* Merging targe table cannot be reloaded when suspend */
- snap_dev_is_open = 1;
- }
- }
- }
-
- if (snap_dev_is_open) {
- log_debug_activation("Postponing pending snapshot merge for origin LV %s.", display_lvname(lv));
- laopts->no_merging = 1;
- }
}
if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
@@ -3163,6 +3158,8 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
if (!dm_tree_preload_children(root, dlid, DLID_SIZE))
goto_out;
+ //if (action == PRELOAD) { log_debug("SLEEP"); sleep(7); }
+
if ((dm_tree_node_size_changed(root) < 0))
dm->flush_required = 1;
/* Currently keep the code require flush for any
7 years, 1 month
master - debug: use display_lvname
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d1c1f60047bb69...
Commit: d1c1f60047bb6973eee432ea14f93058a836faac
Parent: e2ceb90095ab008c13a3d0db0bbf1bc2bd8557f2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 18 11:04:06 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 12:32:56 2016 +0200
debug: use display_lvname
---
tools/toollib.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index b1225cd..5e9b4d8 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1057,13 +1057,15 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
snapshot_lv = find_snapshot(lv)->lv;
if (lv_is_thin_type(snapshot_lv) && !deactivate_lv(cmd, snapshot_lv)) {
if (is_change_activating(activate)) {
- log_error("Refusing to activate merging \"%s\" while snapshot \"%s\" is still active.",
- lv->name, find_snapshot(lv)->lv->name);
+ log_error("Refusing to activate merging volume %s while "
+ "snapshot volume %s is still active.",
+ display_lvname(lv), display_lvname(snapshot_lv));
return 0;
}
- log_error("Cannot fully deactivate merging origin \"%s\" while snapshot \"%s\" is still active.",
- lv->name, find_snapshot(lv)->lv->name);
+ log_error("Cannot fully deactivate merging origin volume %s while "
+ "snapshot volume %s is still active.",
+ display_lvname(lv), display_lvname(snapshot_lv));
r = 0; /* and continue to deactivate origin... */
}
}
7 years, 1 month
master - debug: update message in libdm
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e2ceb90095ab00...
Commit: e2ceb90095ab008c13a3d0db0bbf1bc2bd8557f2
Parent: f5cf6cc9ed756ec1e98d62a31aba803577443ad7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 17 14:51:58 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 12:32:56 2016 +0200
debug: update message in libdm
When dm_tree_find_node_by_uuid() fails to find passed uuid,
report in lof_debug the complete original uuid,
not the one stripped of LVM- prefix.
TODO: inspect manipulation with LVM- prefix here.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 08d7d45..e2301ea 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.122 - 9th April 2016
=================================
+ Do not strip LVM- when debug reporting not found uuid.
Change log_debug ioctl flags from single characters into words.
Version 1.02.121 - 26th March 2016
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index f8b6d89..6f18ae2 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -599,7 +599,7 @@ static struct dm_tree_node *_find_dm_tree_node_by_uuid(struct dm_tree *dtree,
return node;
}
- log_debug("Not matched uuid %s in deptree.", uuid + default_uuid_prefix_len);
+ log_debug("Not matched uuid %s in deptree.", uuid);
return NULL;
}
7 years, 1 month
master - debug: fix error message
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f5cf6cc9ed756e...
Commit: f5cf6cc9ed756ec1e98d62a31aba803577443ad7
Parent: 9cccf5245a97a64f900f253fcf948edd5d7ba8c0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 17 14:44:13 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 12:32:56 2016 +0200
debug: fix error message
log_error is replaced with warn since the result
of function is not result in command error.
---
lib/activate/dev_manager.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 2b108c9..b155039 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -766,11 +766,11 @@ static const struct dm_info *_cached_dm_info(struct dm_pool *mem,
return_NULL;
if (!(dnode = dm_tree_find_node_by_uuid(dtree, dlid)))
- goto_out;
+ goto out;
if (!(dinfo = dm_tree_node_get_info(dnode))) {
- log_error("Failed to get info from tree node for %s.",
- display_lvname(lv));
+ log_warn("WARNING: Cannot get info from tree node for %s.",
+ display_lvname(lv));
goto out;
}
7 years, 1 month
master - thin: improve recognizing of merge in progress
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9cccf5245a97a6...
Commit: 9cccf5245a97a64f900f253fcf948edd5d7ba8c0
Parent: e2cd882f2eef93f02711c34a741bd85d6313eb6e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 18 11:04:16 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 12:32:52 2016 +0200
thin: improve recognizing of merge in progress
Rewrite too condensed condition in more readable form,
wher decision are clearly separated and commented and
also add debug messages for them.
---
lib/activate/dev_manager.c | 59 ++++++++++++++++++++++++++++++++------------
1 files changed, 43 insertions(+), 16 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 6659190..2b108c9 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2764,25 +2764,52 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
/*
* Clear merge attributes if merge isn't currently possible:
* either origin or merging snapshot are open
- * - but use "snapshot-merge" if it is already in use
+ * - for old snaps use "snapshot-merge" if it is already in use
* - open_count is always retrieved (as of dm-ioctl 4.7.0)
* so just use the tree's existing nodes' info
*/
- /* An activating merging origin won't have a node in the tree yet */
- if (((dinfo = _cached_dm_info(dm->mem, dtree, lv, NULL)) &&
- dinfo->open_count) ||
- ((dinfo = _cached_dm_info(dm->mem, dtree,
- seg_is_thin_volume(seg) ?
- seg->lv : seg->cow, NULL)) &&
- dinfo->open_count))
- snap_dev_is_open = 1;
-
- /* Preload considers open devices. */
- /* Resume looks at the table that will be the live one after the operation. */
- if ((!laopts->resuming && snap_dev_is_open && (seg_is_thin_volume(seg) || !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) ||
- (laopts->resuming &&
- ((!seg_is_thin_volume(seg) && !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE)) ||
- (seg_is_thin_volume(seg) && !_thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id))))) {
+ if ((dinfo = _cached_dm_info(dm->mem, dtree,
+ seg_is_thin_volume(seg) ?
+ seg->lv : seg->cow, NULL))) {
+ if (seg_is_thin_volume(seg)) {
+ /* Active thin snapshot prevents merge */
+ log_debug_activation("Merging thin snapshot %s is active.",
+ display_lvname(seg->lv));
+ } else if (dinfo->open_count) {
+ log_debug_activation("Merging snapshot LV %s is openned.",
+ display_lvname(seg->lv));
+ snap_dev_is_open = 1;
+ }
+ }
+
+ if ((dinfo = _cached_dm_info(dm->mem, dtree, lv, NULL))) {
+ if (dinfo->open_count) {
+ log_debug_activation("Merging origin volume %s is openned.", display_lvname(seg->lv));
+ snap_dev_is_open = 1;
+ }
+
+ /* Check if decision needs to be preserved.
+ * Merging origin LV needs to be present in table in this case. */
+ if (!laopts->resuming) {
+ if ((seg_is_thin_volume(seg) && _thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id)) ||
+ (!seg_is_thin_volume(seg) && lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
+ log_debug_activation("Merging of snapshot volume %s is in progress.",
+ display_lvname(seg->lv));
+ /* Merging is already running and cannot be switched */
+ snap_dev_is_open = 0;
+ }
+ } else {
+ if ((seg_is_thin_volume(seg) && !_thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id)) ||
+ (!seg_is_thin_volume(seg) && !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
+ log_debug_activation("Merging of snapshot volume %s was not started before suspend.",
+ display_lvname(seg->lv));
+ /* Merging targe table cannot be reloaded when suspend */
+ snap_dev_is_open = 1;
+ }
+ }
+ }
+
+ if (snap_dev_is_open) {
log_debug_activation("Postponing pending snapshot merge for origin LV %s.", display_lvname(lv));
laopts->no_merging = 1;
}
7 years, 1 month
master - thin: check runtime table line for merging
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e2cd882f2eef93...
Commit: e2cd882f2eef93f02711c34a741bd85d6313eb6e
Parent: 662090e3587d248f1c53bd8dc2989ba0b1960085
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 17 14:51:48 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 18 11:18:35 2016 +0200
thin: check runtime table line for merging
To recognize in runtime if we are merging or not
to make consistent decision between suspend and resume
add function to parse thin table line when add
merging thin device to the table.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 65 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 123c383..863fe30 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.151 -
=================================
+ Recognize in-progress snapshot merge for thin volumes from dm table.
Avoid deciding to initiate a pending snapshot merge during resume.
Improve retrying lvmetad requests while lvmetad is being updated.
Read devices instead of using the lvmetad cache if rescan fails.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 92f2a05..6659190 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -840,6 +840,67 @@ bad:
return r;
}
+static int _thin_lv_has_device_id(struct dm_pool *mem, const struct logical_volume *lv,
+ const char *layer, unsigned device_id)
+{
+ char *dlid;
+ struct dm_task *dmt;
+ struct dm_info info;
+ void *next = NULL;
+ uint64_t start, length;
+ char *type = NULL;
+ char *params = NULL;
+ unsigned id = ~0;
+
+ if (!(dlid = build_dm_uuid(mem, lv, layer)))
+ return_0;
+
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_TABLE, 0, 0, 0)))
+ goto_bad;
+
+ if (!dm_task_run(dmt))
+ goto_out;
+
+ if (!dm_task_get_info(dmt, &info) || !info.exists)
+ goto_out;
+
+ /* If there is a preloaded table, use that in preference. */
+ if (info.inactive_table) {
+ dm_task_destroy(dmt);
+
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_TABLE, 0, 0, 0)))
+ goto_bad;
+
+ if (!dm_task_query_inactive_table(dmt))
+ goto_out;
+
+ if (!dm_task_run(dmt))
+ goto_out;
+
+ if (!dm_task_get_info(dmt, &info) || !info.exists || !info.inactive_table)
+ goto_out;
+ }
+
+ (void) dm_get_next_target(dmt, next, &start, &length, &type, ¶ms);
+
+ if (!type || strcmp(type, TARGET_NAME_THIN))
+ goto_out;
+
+ if (!params || sscanf(params, "%*u:%*u %u", &id) != 1)
+ goto_out;
+
+ log_debug_activation("%soaded thin volume %s with id %u is %smatching id %u.",
+ info.inactive_table ? "Prel" : "L",
+ display_lvname(lv), id,
+ (device_id != id) ? "not " : "", device_id);
+out:
+ dm_task_destroy(dmt);
+bad:
+ dm_pool_free(mem, dlid);
+
+ return (device_id == id);
+}
+
int add_linear_area_to_dtree(struct dm_tree_node *node, uint64_t size, uint32_t extent_size, int use_linear_target, const char *vgname, const char *lvname)
{
uint32_t page_size;
@@ -2719,7 +2780,9 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
/* Preload considers open devices. */
/* Resume looks at the table that will be the live one after the operation. */
if ((!laopts->resuming && snap_dev_is_open && (seg_is_thin_volume(seg) || !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) ||
- (laopts->resuming && !seg_is_thin_volume(seg) && !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
+ (laopts->resuming &&
+ ((!seg_is_thin_volume(seg) && !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE)) ||
+ (seg_is_thin_volume(seg) && !_thin_lv_has_device_id(dm->mem, lv, NULL, seg->device_id))))) {
log_debug_activation("Postponing pending snapshot merge for origin LV %s.", display_lvname(lv));
laopts->no_merging = 1;
}
7 years, 1 month
master - tests: fix check_lvmlockd_test
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=662090e3587d24...
Commit: 662090e3587d248f1c53bd8dc2989ba0b1960085
Parent: 6954de22e2281876506c0db1c98972242de977fb
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 15 12:35:20 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 15 12:35:20 2016 -0500
tests: fix check_lvmlockd_test
---
test/lib/flavour-udev-lvmlockd-test.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/flavour-udev-lvmlockd-test.sh b/test/lib/flavour-udev-lvmlockd-test.sh
index 17ef516..d2a7b4a 100644
--- a/test/lib/flavour-udev-lvmlockd-test.sh
+++ b/test/lib/flavour-udev-lvmlockd-test.sh
@@ -6,4 +6,4 @@ export LVM_TEST_LVMLOCKD_TEST=1
export LVM_TEST_DEVDIR=/dev
# FIXME:dct: add option to allow --test with sanlock
-LVM_TEST_LVMLOCKD_TEST_DLM=1
+export LVM_TEST_LVMLOCKD_TEST_DLM=1
7 years, 1 month
master - activate: Improve snapshot merge initiation
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6954de22e22818...
Commit: 6954de22e2281876506c0db1c98972242de977fb
Parent: 150cff9cce019e3211d99dbdceaccf77db1e503a
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Apr 15 02:21:27 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Apr 15 02:33:38 2016 +0100
activate: Improve snapshot merge initiation
A snapshot merge into its origin cannot be initiated while the devices
are in use. If there is outside interference (such as from udev),
the suspend (preload) and resume stages can reach conflicting decisions
about whether or not to proceed.
Try to make the logic more robust by checking the inactive or live
table during resume. (This is still not perfect.)
---
WHATS_NEW | 1 +
lib/activate/activate.c | 1 +
lib/activate/activate.h | 1 +
lib/activate/dev_manager.c | 40 +++++++++++++++++++++++++++++-----------
4 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8c58c8d..123c383 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.151 -
=================================
+ Avoid deciding to initiate a pending snapshot merge during resume.
Improve retrying lvmetad requests while lvmetad is being updated.
Read devices instead of using the lvmetad cache if rescan fails.
Move lvmetad token/filter check and device rescan to the start of commands.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 8e6ee33..ac547ce 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2063,6 +2063,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
}
laopts->read_only = _passes_readonly_filter(cmd, lv);
+ laopts->resuming = 1;
if (!_lv_activate_lv(lv, laopts))
goto_out;
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index 64c026e..880689c 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -81,6 +81,7 @@ struct lv_activate_opts {
* set of flags to avoid any scanning in udev. These udev
* flags are persistent in udev db for any spurious event
* that follows. */
+ unsigned resuming; /* Set when resuming after a suspend. */
};
void set_activation(int activation, int silent);
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index d25c07e..92f2a05 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -806,13 +806,28 @@ int lv_has_target_type(struct dm_pool *mem, const struct logical_volume *lv,
if (!dm_task_get_info(dmt, &info) || !info.exists)
goto_out;
+ /* If there is a preloaded table, use that in preference. */
+ if (info.inactive_table) {
+ dm_task_destroy(dmt);
+
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
+ goto_bad;
+
+ if (!dm_task_query_inactive_table(dmt))
+ goto_out;
+
+ if (!dm_task_run(dmt))
+ goto_out;
+
+ if (!dm_task_get_info(dmt, &info) || !info.exists || !info.inactive_table)
+ goto_out;
+ }
+
do {
next = dm_get_next_target(dmt, next, &start, &length,
&type, ¶ms);
- if (type && strncmp(type, target_type,
- strlen(target_type)) == 0) {
- if (info.live_table)
- r = 1;
+ if (type && !strncmp(type, target_type, strlen(target_type))) {
+ r = 1;
break;
}
} while (next);
@@ -2665,6 +2680,7 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
uint32_t read_ahead = lv->read_ahead;
uint32_t read_ahead_flags = UINT32_C(0);
int save_pending_delete = dm->track_pending_delete;
+ int snap_dev_is_open = 0;
/* LV with pending delete is never put new into a table */
if (lv_is_pending_delete(lv) && !_cached_dm_info(dm->mem, dtree, lv, NULL))
@@ -2697,13 +2713,15 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
((dinfo = _cached_dm_info(dm->mem, dtree,
seg_is_thin_volume(seg) ?
seg->lv : seg->cow, NULL)) &&
- dinfo->open_count)) {
- if (seg_is_thin_volume(seg) ||
- /* FIXME Is there anything simpler to check for instead? */
- !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE)) {
- log_debug_activation("Postponing pending snapshot merge for origin LV %s.", display_lvname(lv));
- laopts->no_merging = 1;
- }
+ dinfo->open_count))
+ snap_dev_is_open = 1;
+
+ /* Preload considers open devices. */
+ /* Resume looks at the table that will be the live one after the operation. */
+ if ((!laopts->resuming && snap_dev_is_open && (seg_is_thin_volume(seg) || !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) ||
+ (laopts->resuming && !seg_is_thin_volume(seg) && !lv_has_target_type(dm->mem, lv, NULL, TARGET_NAME_SNAPSHOT_MERGE))) {
+ log_debug_activation("Postponing pending snapshot merge for origin LV %s.", display_lvname(lv));
+ laopts->no_merging = 1;
}
}
7 years, 1 month