Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bf4681ba134914e5…
Commit: bf4681ba134914e5847d94bc0ca01b7a2af0b2b5
Parent: 160777bb3eda1cae32511292070c92e076305ef6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Nov 5 10:35:38 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Nov 5 10:42:18 2014 +0100
report: cleanup: simplify LVSINFO detection
LVSINFO is just a subtype of LVS report type with extra "info" ioctl
called for each LV reported (per output line) so include its processing
within "case LVS" switch, not as completely different kind of reporting
which may be misleading when reading the code.
There's already the "lv_info_needed" flag set in the _report fn, so
call the approriate reporting function based on this flag within the
"case LVS" switch line.
Actually the same is already done for LV is reported per segments
within the "case SEGS" switch line. So this patch makes the code more
consistent so it's processed the same way for all cases.
Also, this is a preparation for another and new subtype that will
be introduced later - the "LVSSTATUS" and "SEGSSTATUS" report type.
---
tools/reporter.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 02f6064..080e3d5 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -394,9 +394,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type = PVS;
else if (report_type & SEGS)
report_type = SEGS;
- else if (report_type & LVSINFO)
- report_type = LVSINFO;
- else if (report_type & LVS)
+ else if (report_type & (LVS | LVSINFO))
report_type = LVS;
/*
@@ -418,11 +416,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
break;
case LVS:
r = process_each_lv(cmd, argc, argv, 0, report_handle,
- &_lvs_single);
- break;
- case LVSINFO:
- r = process_each_lv(cmd, argc, argv, 0, report_handle,
- &_lvs_with_info_single);
+ lv_info_needed ? &_lvs_with_info_single
+ : &_lvs_single);
break;
case VGS:
r = process_each_vg(cmd, argc, argv, 0,
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=89f635a0759dd949…
Commit: 89f635a0759dd9499155b4bf6bf8c07090444ade
Parent: 6b25faa218fc5cd1601e5418ce1481400386ecce
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Nov 4 16:58:14 2014 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Nov 4 16:58:14 2014 +0000
dmeventd: Include shutdown threads in responses.
When responding to DM_EVENT_CMD_GET_REGISTERED_DEVICE no longer
ignore threads that have already been unregistered but which
are still present.
This means the caller can unregister a device and poll dmeventd
to ensure the monitoring thread has gone away before removing
the device. If a device was registered and unregistered in quick
succession and then removed, WAITEVENT could run in parallel with
the REMOVE.
Threads are moved to the _thread_registry_unused list when they
are unregistered.
---
WHATS_NEW | 1 +
daemons/dmeventd/dmeventd.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3914392..6c76fa9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Include threads being shutdown in dmeventd device registration responses.
Inital support for external users of thin pools based on transaction_id.
Report some basic percentage info for cache pools.
Introduce size_mb_arg_with_percent() for advanced size arg reading.
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index faae5ba..1b950cf 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1177,6 +1177,18 @@ static int _get_registered_dev(struct message_data *message_data, int next)
if (hit && !next)
goto reg;
+ /*
+ * If we didn't get a match, try the threads waiting to be deleted.
+ * FIXME Do something similar if 'next' is set.
+ */
+ if (!hit && !next)
+ dm_list_iterate_items(thread, &_thread_registry_unused)
+ if (_want_registered_device(message_data->dso_name,
+ message_data->device_uuid, thread)) {
+ hit = thread;
+ goto reg;
+ }
+
if (!hit)
goto out;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=00a45ca491de2133…
Commit: 00a45ca491de21336f8d1d0253344995cea3b4f0
Parent: 8563c3e1a96f0d7ad180c859e9bf23a90e63e907
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 4 10:33:35 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 4 15:29:22 2014 +0100
thin: new pool is activated without overlay
Activate of new/unused/empty thin pool volume skips
the 'overlay' part and directly provides 'visible' thin-pool LV to the user.
Such thin pool still gets 'private' -tpool UUID suffix for easier
udev detection of protected lvm2 devices, and also gets udev flags to
avoid any scan.
Such pool device is 'public' LV with regular /dev/vgname/poolname link,
but it's still 'udev' hidden device for any other use.
To display proper active state we need to do few explicit tests
for this condition.
Before it's used for any lvm2 thin volume, deactivation is
now needed to avoid any 'race' with external usage.
---
lib/activate/activate.c | 4 ++++
lib/activate/dev_manager.c | 15 ++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 49e86e7..c2a662f 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -641,6 +641,10 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la
fs_unlock(); /* For non clustered - wait if there are non-delete ops */
}
+ /* New thin-pool has no layer, but -tpool suffix needs to be queried */
+ if (!use_layer && lv_is_new_thin_pool(lv))
+ use_layer = 1;
+
if (!dev_manager_info(cmd->mem, lv,
(use_layer) ? lv_layer(lv) : NULL,
with_open_count, with_read_ahead,
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 41911c1..e81c5d3 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1527,7 +1527,11 @@ static uint16_t _get_udev_flags(struct dev_manager *dm, const struct logical_vol
* If not, create just the /dev/mapper content.
*/
/* FIXME: add target's method for this */
- if (layer || !lv_is_visible(lv) || lv_is_thin_pool(lv))
+ if (lv_is_new_thin_pool(lv))
+ /* New thin-pool is regular LV with -tpool UUID suffix. */
+ udev_flags |= DM_UDEV_DISABLE_DISK_RULES_FLAG |
+ DM_UDEV_DISABLE_OTHER_RULES_FLAG;
+ else if (layer || !lv_is_visible(lv) || lv_is_thin_pool(lv))
udev_flags |= DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG |
DM_UDEV_DISABLE_DISK_RULES_FLAG |
DM_UDEV_DISABLE_OTHER_RULES_FLAG;
@@ -2604,6 +2608,10 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
return_0;
+ /* Even unused thin-pool still needs to get layered UUID -suffix */
+ if (!layer && lv_is_new_thin_pool(lv))
+ layer = lv_layer(lv);
+
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
@@ -2679,8 +2687,9 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
if (!_add_snapshot_target_to_dtree(dm, dnode, lv, laopts))
return_0;
- } else if ((lv_is_external_origin(lv) || lv_is_thin_pool(lv)) && !layer) {
- /* External origin or Thin pool is using layer */
+ } else if (!layer && ((lv_is_thin_pool(lv) && !lv_is_new_thin_pool(lv)) ||
+ lv_is_external_origin(lv))) {
+ /* External origin or 'used' Thin pool is using layer */
if (!_add_new_lv_to_dtree(dm, dtree, lv, laopts, lv_layer(lv)))
return_0;
if (!_add_layer_target_to_dtree(dm, dnode, lv))
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8563c3e1a96f0d7a…
Commit: 8563c3e1a96f0d7ad180c859e9bf23a90e63e907
Parent: 6116b1d6e302097086c9dcd418e4404ddd337939
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 4 15:08:15 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 4 15:29:19 2014 +0100
thin: check for new pool before creating thin volume
Call check_new_thin_pool() to detect in-use thin-pool.
Save extra reactivation of thin-pool when thin pool is not active.
(it's now a bit more expensive to invoke thin_check for new pools.)
For new pools:
We now active locally exclusively thin-pool as 'public' LV.
Validate transaction_id is till 0.
Deactive.
Prepare create message for thin-pool and exclusively active pool.
Active new thin LV.
And deactivate thin pool if it used to be inactive.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 37 +++++++++++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d824289..3914392 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Inital support for external users of thin pools based on transaction_id.
Report some basic percentage info for cache pools.
Introduce size_mb_arg_with_percent() for advanced size arg reading.
Add extra support for '.' as decimal point in size args.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b5fc84a..d3c0c47 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6559,6 +6559,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
struct logical_volume *pool_lv = NULL;
struct logical_volume *tmp_lv;
struct lv_segment *seg, *pool_seg;
+ int thin_pool_was_active = -1; /* not scanned, inactive, active */
if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
log_error("Logical volume \"%s\" already exists in "
@@ -6679,6 +6680,14 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
+ if (seg_is_thin_volume(lp) &&
+ lv_is_new_thin_pool(pool_lv)) {
+ thin_pool_was_active = lv_is_active(pool_lv);
+ if (!check_new_thin_pool(pool_lv))
+ return_NULL;
+ /* New pool is now inactive */
+ }
+
if (seg_is_cache(lp) &&
!wipe_cache_pool(pool_lv))
return_NULL;
@@ -7003,7 +7012,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
goto revert_new_lv;
}
/* At this point remove pool messages, snapshot is active */
- if (!update_pool_lv(first_seg(origin_lv)->pool_lv, 0)) {
+ if (!update_pool_lv(pool_lv, 0)) {
stack;
goto revert_new_lv;
}
@@ -7013,7 +7022,23 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
if (is_change_activating(lp->activate)) {
/* Send message so that table preload knows new thin */
- if (!update_pool_lv(first_seg(lv)->pool_lv, 1)) {
+ if (!lv_is_active(pool_lv)) {
+ /* Avoid multiple thin-pool activations in this case */
+ if (thin_pool_was_active < 0)
+ thin_pool_was_active = 0;
+ if (!activate_lv_excl(cmd, pool_lv)) {
+ log_error("Failed to activate thin pool %s/%s.",
+ origin_lv->vg->name, origin_lv->name);
+ goto revert_new_lv;
+ }
+ if (!lv_is_active(pool_lv)) {
+ log_error("Cannot activate thin pool %s, perhaps skipped in lvm.conf volume_list?",
+ display_lvname(pool_lv));
+ return 0;
+ }
+ }
+ /* Keep thin pool active until thin volume is activated */
+ if (!update_pool_lv(pool_lv, (thin_pool_was_active < 0) ? 1 : 0)) {
stack;
goto revert_new_lv;
}
@@ -7024,6 +7049,14 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
log_error("Failed to activate thin %s.", lv->name);
goto deactivate_and_revert_new_lv;
}
+
+ /* Restore inactive state if needed */
+ if (!thin_pool_was_active &&
+ !deactivate_lv(cmd, pool_lv)) {
+ log_error("Failed to deactivate thin pool %s.",
+ display_lvname(pool_lv));
+ return NULL;
+ }
}
} else if (lp->snapshot) {
if (!activate_lv_local(cmd, lv)) {