summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-05-11 22:19:12 +0000
committerAlasdair Kergon <agk@redhat.com>2012-05-11 22:19:12 +0000
commit8a689fd04d7cb0f64d0d9e2c284c7595c3d03beb (patch)
treeaf15849a52a22ce248a525c447db5f6c6dab8c0a
parent01cfbe14f1b9b780d848c7acbb60a0504b6b86ff (diff)
downloadlvm2-8a689fd04d7cb0f64d0d9e2c284c7595c3d03beb.tar.gz
lvm2-8a689fd04d7cb0f64d0d9e2c284c7595c3d03beb.tar.xz
lvm2-8a689fd04d7cb0f64d0d9e2c284c7595c3d03beb.zip
Fix allocation policy loop so it doesn't continue beyond cling using later
policies it shouldn't be using when --alloc cling is specified but no tags are defined.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/metadata/lv_manip.c6
2 files changed, 4 insertions, 3 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 6ee8eef4..68ab3af3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.96 -
================================
+ Fix policy loop not to use later policies when --alloc cling without tags.
Append _TO_LVSEG to names of internal A_CONTIGUOUS and A_CLING flags.
Add missing pkg init --with-systemdsystemunitdir in configure.in (2.02.92).
Fix division by zero if PV with zero PE count is used during vgcfgrestore.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index adc5e896..25d20af8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2022,7 +2022,7 @@ static int _allocate(struct alloc_handle *ah,
ah->alloc = ALLOC_CLING_BY_TAGS;
/* Attempt each defined allocation policy in turn */
- for (alloc = ALLOC_CONTIGUOUS; alloc < ALLOC_INHERIT; alloc++) {
+ for (alloc = ALLOC_CONTIGUOUS; alloc <= ah->alloc; alloc++) {
/* Skip cling_by_tags if no list defined */
if (alloc == ALLOC_CLING_BY_TAGS && !ah->cling_tag_list_cn)
continue;
@@ -2039,7 +2039,7 @@ static int _allocate(struct alloc_handle *ah,
if (!_find_max_parallel_space_for_one_policy(ah, &alloc_parms, pvms, &alloc_state))
goto_out;
- if ((alloc_state.allocated == ah->new_extents && !alloc_state.log_area_count_still_needed) || (ah->alloc == alloc) ||
+ if ((alloc_state.allocated == ah->new_extents && !alloc_state.log_area_count_still_needed) ||
(!can_split && (alloc_state.allocated != old_allocated)))
break;
}
@@ -2154,7 +2154,7 @@ struct alloc_handle *allocate_extents(struct volume_group *vg,
return NULL;
}
- if (alloc == ALLOC_INHERIT)
+ if (alloc >= ALLOC_INHERIT)
alloc = vg->alloc;
new_extents = (lv ? lv->le_count : 0) + extents;