Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c87e5a308a95e6e7…
Commit: c87e5a308a95e6e7c2d120ce816df14644f8e70a
Parent: f3bb1c018f7b6e38f0351a9994760bae7d9f00e3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Oct 8 10:57:44 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Oct 8 11:03:08 2014 +0200
filter-usable: filter out blocked and suspended devices firmly when scanning for lvmetad
We can't hang on blocked or suspended devices when the scan is done
for lvmetad update - when the device gets unblocked or resumed, there's
always CHANGE event generated which will fire the udev rule to run
extra pvscan --cache for that device which makes sure that lvmetad
is up-to-date.
---
lib/filters/filter-usable.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/filters/filter-usable.c b/lib/filters/filter-usable.c
index 2a7ef49..a6932b0 100644
--- a/lib/filters/filter-usable.c
+++ b/lib/filters/filter-usable.c
@@ -36,8 +36,15 @@ static int _passes_usable_filter(struct dev_filter *f, struct device *dev)
break;
case FILTER_MODE_PRE_LVMETAD:
ucp.check_empty = 1;
- ucp.check_blocked = 0;
- ucp.check_suspended = ignore_suspended_devices();
+ /*
+ * If we're scanning for lvmetad update,
+ * we don't want to hang on blocked/suspended devices.
+ * When the device is unblocked/resumed, surely,
+ * there's going to be a CHANGE event so the device
+ * gets scanned via udev rule anyway after resume.
+ */
+ ucp.check_blocked = 1;
+ ucp.check_suspended = 1;
ucp.check_error_target = 1;
ucp.check_reserved = 1;
break;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88959032f7efb922…
Commit: 88959032f7efb9229632c74a3738aae171f0c460
Parent: 0cbb381e159f0606ec749697a596d2a6cc814283
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Oct 7 16:06:21 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Oct 7 16:11:56 2014 +0200
metadata: Fix find_pv_in_vg for missing PVs/filtered devices.
---
lib/metadata/metadata.c | 35 ++++++++++++-----------------------
1 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 3e5bd5d..5c154bd 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1778,31 +1778,20 @@ struct pv_list *find_pv_in_vg(const struct volume_group *vg,
const char *pv_name)
{
struct pv_list *pvl;
+ struct device *dev = dev_cache_get(pv_name, vg->cmd->filter);
- dm_list_iterate_items(pvl, &vg->pvs) {
- if (!pvl->pv->dev) {
- /*
- * pv_dev can't be NULL here!
- * We have to catch this situation earlier in the
- * code if this internal error is hit. Otherwise,
- * there's a possibility that pv_dev will match
- * cached_dev in case both are NULL.
- *
- * NULL cached_dev may happen in case this device
- * is filtered and NULL pv_dev may happen if the
- * device is missing!
- *
- * If such incorrect match was hit, simply incorrect
- * PV would be processed. This really needs to be
- * handled earlier in the code in that case.
- */
- log_error(INTERNAL_ERROR "find_pv_in_vg: PV that is not "
- "bound to any existing device found.");
- return NULL;
- }
- if (pvl->pv->dev == dev_cache_get(pv_name, vg->cmd->filter))
+ /*
+ * If the device does not exist or is filtered out, don't bother trying
+ * to find it in the list. This also prevents accidentally finding a
+ * non-NULL PV which happens to be missing (i.e. its pv->dev is NULL)
+ * for such devices.
+ */
+ if (!dev)
+ return NULL;
+
+ dm_list_iterate_items(pvl, &vg->pvs)
+ if (pvl->pv->dev == dev)
return pvl;
- }
return NULL;
}
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0cbb381e159f0606…
Commit: 0cbb381e159f0606ec749697a596d2a6cc814283
Parent: 27ff61d012740dcdb8f5cf6421c22f746d056fe1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 7 15:41:54 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Oct 7 15:52:31 2014 +0200
lvcreate: regression fix on lv name limits
When we are given an existing LV name - it needs to be allowed
to pass in even restricted name as the LV could have existed
long before we introduced some new restriction on prefix/suffix.i
Fix the regression on name limits and drop restriction to be applied
on any existing LVs - only the new created LV names have to be
complient with current name restrictions.
FIXME: we are currently using restricted names incorrectly in few
other places - device_is_usable() skips restricted names,
and udev flags are also incorrectly set for restricted names
so these LVs are not getting links properly.
---
lib/metadata/lv_manip.c | 6 ++++++
tools/lvcreate.c | 3 +++
tools/toollib.c | 3 ---
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 892f7ca..f14cec0 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7172,6 +7172,9 @@ struct logical_volume *lv_create_single(struct volume_group *vg,
!(lp->segtype = get_segtype_from_string(vg->cmd, "thin-pool")))
return_NULL;
+ if (lp->pool_name && !apply_lvname_restrictions(lp->pool_name))
+ return_NULL;
+
if (!(lv = _lv_create_an_lv(vg, lp, lp->pool_name)))
return_NULL;
@@ -7188,6 +7191,9 @@ struct logical_volume *lv_create_single(struct volume_group *vg,
"cache-pool")))
return_NULL;
+ if (lp->pool_name && !apply_lvname_restrictions(lp->pool_name))
+ return_NULL;
+
if (!(lv = _lv_create_an_lv(vg, lp, lp->pool_name)))
return_NULL;
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 2fa7918..41b8ee3 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -54,6 +54,9 @@ static int _lvcreate_name_params(struct lvcreate_params *lp,
if (!validate_lvname_param(cmd, &lp->vg_name, &lp->lv_name))
return_0;
+ if (lp->lv_name && !apply_lvname_restrictions(lp->lv_name))
+ return_0;
+
lp->pool_name = arg_str_value(cmd, thinpool_ARG, NULL)
? : arg_str_value(cmd, cachepool_ARG, NULL);
if (!validate_lvname_param(cmd, &lp->vg_name, &lp->pool_name))
diff --git a/tools/toollib.c b/tools/toollib.c
index 1ee8469..3b1b00f 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1300,9 +1300,6 @@ int validate_lvname_param(struct cmd_context *cmd, const char **vg_name,
*lv_name = lvname;
}
- if (!apply_lvname_restrictions(*lv_name))
- return_0;
-
if (!validate_name(*lv_name)) {
log_error("Logical volume name \"%s\" is invalid.",
*lv_name);