Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e710bac03d2625a5…
Commit: e710bac03d2625a50131ac325ad90f0d4f6f3d51
Parent: b82d5ee0926acee37356f5a322edbb4694081699
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 14 13:26:15 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 14 13:34:36 2016 -0600
Revert "lvmcache: skip drop when vg_write lock is not held"
This reverts e28e22b9e1e4f7243608aa24ddf43ec63afd1751
The problem that that commit was fixing (pytest failure)
no longer appears with the current code, so the commit is
not needed.
That commit is a problem for pvchange, because it prevents
lvmcache from retaining VG metadata even while the global
lock is held. pvchange holds the global lock to ensure
that VG metadata is kept in lvmcache throughout processing.
If the cache is not kept, a PV with zero MDAs will appear
first in its actual VG and then appear again in the orphan VG.
It wrongly appears a second time in the orphan VG only if
the actual VG is dropped from lvmcache.
---
lib/cache/lvmcache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 998ea6f..1363e93 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -332,7 +332,7 @@ void lvmcache_commit_metadata(const char *vgname)
void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
{
- if (lvmcache_vgname_is_locked(VG_GLOBAL) && !vg_write_lock_held())
+ if (lvmcache_vgname_is_locked(VG_GLOBAL))
return;
/* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d09c8c2c45ea1de…
Commit: 6d09c8c2c45ea1dea243134b8badc841a87cc979
Parent: 88400b599efa2a06fcc29c1c69ef450aa0c98524
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jan 14 09:12:57 2016 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jan 14 09:12:57 2016 -0600
Revert "process_each_pv: remove unnecessary workaround"
This reverts commit be1b1f3d8941543bcde2f42e65ed0f22fd07b122.
---
tools/toollib.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 97cc1bf..728e61d 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3033,6 +3033,7 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
const char *pv_name;
int selected;
int process_pv;
+ int dev_found;
int ret_max = ECMD_PROCESSED;
int ret = 0;
@@ -3086,7 +3087,21 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
else
log_very_verbose("Processing PV %s in VG %s.", pv_name, vg->name);
- _device_list_remove(all_devices, pv->dev);
+ dev_found = _device_list_remove(all_devices, pv->dev);
+
+ /*
+ * FIXME PVs with no mdas may turn up in an orphan VG when
+ * not using lvmetad as well as their correct VG. They
+ * will be missing from all_devices the second time
+ * around but must not be processed twice or trigger a message.
+ *
+ * Missing PVs will also need processing even though they are
+ * not present in all_devices.
+ */
+ if (!dev_found && !is_missing_pv(pv)) {
+ log_verbose("Skipping PV %s in VG %s: not in device list.", pv_name, vg->name);
+ continue;
+ }
if (!skip) {
ret = process_single_pv(cmd, vg, pv, handle);
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c9a813bff8828e37…
Commit: c9a813bff8828e379f9be963a49a9201a3484ec6
Parent: 7d2b7f2bd8c318ed65097d4cb7141b3035e43e2f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jan 11 14:11:37 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jan 14 11:34:05 2016 +0100
cleanup: spaces
---
lib/metadata/lv_manip.c | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 99f3661..ca9e0a1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1666,7 +1666,7 @@ static void _init_alloc_parms(struct alloc_handle *ah,
alloc_parms->flags |= A_PARTITION_BY_TAGS;
/*
- * For normal allocations, if any extents have already been found
+ * For normal allocations, if any extents have already been found
* for allocation, prefer to place further extents on the same disks as
* have already been used.
*/
@@ -2010,7 +2010,7 @@ static int _is_same_pv(struct pv_match *pvmatch __attribute((unused)), struct pv
}
/*
- * Does PV area have a tag listed in allocation/cling_tag_list that
+ * Does PV area have a tag listed in allocation/cling_tag_list that
* matches EITHER a tag of the PV of the existing segment OR a tag in pv_tags?
* If tags_list_str is set, then instead we generate a list of matching tags for printing.
*/
@@ -2166,7 +2166,7 @@ static int _pv_has_matching_tag(const struct dm_config_node *cling_tag_list_cn,
}
/*
- * Does PV area have a tag listed in allocation/cling_tag_list that
+ * Does PV area have a tag listed in allocation/cling_tag_list that
* matches a tag of the PV of the existing segment?
*/
static int _pvs_have_matching_tag(const struct dm_config_node *cling_tag_list_cn,
@@ -2205,8 +2205,8 @@ static void _reserve_area(struct alloc_handle *ah, struct alloc_state *alloc_sta
log_debug_alloc("%s allocation area %" PRIu32 " %s %s start PE %" PRIu32
" length %" PRIu32 " leaving %" PRIu32 "%s%s.",
- area_used->pva ? "Changing " : "Considering",
- ix_pva, area_used->pva ? "to" : "as",
+ area_used->pva ? "Changing " : "Considering",
+ ix_pva, area_used->pva ? "to" : "as",
dev_name(pva->map->pv->dev), pva->start, required, unreserved,
pv_tag_list ? " with PV tags: " : "",
pv_tag_list ? : "");
@@ -2468,7 +2468,7 @@ static uint32_t _calc_required_extents(struct alloc_handle *ah, struct pv_area *
uint32_t required = max_to_allocate / ah->area_multiple;
/*
- * Update amount unreserved - effectively splitting an area
+ * Update amount unreserved - effectively splitting an area
* into two or more parts. If the whole stripe doesn't fit,
* reduce amount we're looking for.
*/
@@ -2669,7 +2669,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah,
goto next_pv;
/*
- * Avoid PVs already set aside for log.
+ * Avoid PVs already set aside for log.
* We only reach here if there were enough PVs for the main areas but
* not enough for the logs.
*/
@@ -2697,7 +2697,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah,
*
* USE_AREA are stored for later, then sorted and chosen from.
*/
- switch(_check_pva(ah, pva, max_to_allocate,
+ switch(_check_pva(ah, pva, max_to_allocate,
alloc_state, already_found_one, iteration_count, log_iteration_count)) {
case PREFERRED:
@@ -2802,7 +2802,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah,
return 1;
/*
- * FIXME We should change the code to do separate calls for the log allocation
+ * FIXME We should change the code to do separate calls for the log allocation
* and the data allocation so that _limit_to_one_area_per_tag doesn't have to guess
* where the split is going to occur.
*/
@@ -2853,7 +2853,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah,
}
/*
- * Choose sets of parallel areas to use, respecting any constraints
+ * Choose sets of parallel areas to use, respecting any constraints
* supplied in alloc_parms.
*/
static int _find_max_parallel_space_for_one_policy(struct alloc_handle *ah, struct alloc_parms *alloc_parms,
@@ -4600,7 +4600,7 @@ static int _lvresize_poolmetadata(struct cmd_context *cmd, struct volume_group *
return 1;
}
-static int _lvresize_check_lv(struct cmd_context *cmd, struct logical_volume *lv,
+static int _lvresize_check_lv(struct cmd_context *cmd, struct logical_volume *lv,
struct lvresize_params *lp)
{
struct volume_group *vg = lv->vg;
@@ -4674,7 +4674,7 @@ static int _lvresize_check_lv(struct cmd_context *cmd, struct logical_volume *lv
return 1;
}
-static int _lvresize_adjust_size(struct cmd_context *cmd, struct logical_volume *lv,
+static int _lvresize_adjust_size(struct cmd_context *cmd, struct logical_volume *lv,
struct lvresize_params *lp)
{
struct volume_group *vg = lv->vg;
@@ -4845,7 +4845,7 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
/* Initial decision on whether we are extending or reducing */
if (lp->sign == SIGN_MINUS ||
- (lp->sign == SIGN_NONE &&
+ (lp->sign == SIGN_NONE &&
((lp->extents_are_pes && lp->extents < existing_physical_extents) ||
(!lp->extents_are_pes && lp->extents < existing_logical_extents))))
reducing = 1;
@@ -4886,10 +4886,10 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
(!seg_is_raid(seg) || seg_is_mirrored(seg)) &&
!seg_is_raid10(seg))
continue;
-
+
sz = seg->stripe_size;
str = seg->area_count - lp->segtype->parity_devs;
-
+
if ((seg_stripesize && seg_stripesize != sz &&
sz && !lp->stripe_size) ||
(seg_stripes && seg_stripes != str && !lp->stripes)) {
@@ -4897,11 +4897,11 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
"stripes (-i) and stripesize (-I)");
return 0;
}
-
+
seg_stripesize = sz;
seg_stripes = str;
}
-
+
if (!lp->stripes)
lp->stripes = seg_stripes;
else if (seg_is_raid(first_seg(lv)) &&
@@ -4910,7 +4910,7 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
lvseg_name(first_seg(lv)));
return 0;
}
-
+
if (!lp->stripe_size && lp->stripes > 1) {
if (seg_stripesize) {
log_print_unless_silent("Using stripesize of last segment %s",
@@ -5022,7 +5022,7 @@ static int _lvresize_adjust_extents(struct cmd_context *cmd, struct logical_volu
}
}
}
- }
+ }
/* At this point, lp->extents should hold the correct NEW logical size required. */
@@ -5259,7 +5259,7 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
return lock_lv;
}
-int lv_resize_prepare(struct cmd_context *cmd, struct logical_volume *lv,
+int lv_resize_prepare(struct cmd_context *cmd, struct logical_volume *lv,
struct lvresize_params *lp, struct dm_list *pvh)
{
if (!_lvresize_check_lv(cmd, lv, lp))
@@ -5291,7 +5291,7 @@ int lv_resize_prepare(struct cmd_context *cmd, struct logical_volume *lv,
}
/* lv_resize_prepare MUST be called before this */
-int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
+int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
struct lvresize_params *lp, struct dm_list *pvh)
{
struct volume_group *vg = lv->vg;
@@ -5479,13 +5479,13 @@ struct logical_volume *lv_create_empty(const char *name,
if (!lv_set_creation(lv, NULL, 0))
goto_bad;
-
+
if (fi->fmt->ops->lv_setup && !fi->fmt->ops->lv_setup(fi, lv))
goto_bad;
if (vg->fid->fmt->features & FMT_CONFIG_PROFILE)
lv->profile = vg->cmd->profile_params->global_metadata_profile;
-
+
return lv;
bad:
dm_pool_free(vg->vgmem, lv);