1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Check lv_count in vg_validate.

Fix internal LV counter when a snapshot is removed.
This commit is contained in:
Alasdair Kergon 2008-04-22 12:54:33 +00:00
parent a93ae114b8
commit fd1b118942
3 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.36 -
=================================
Check lv_count in vg_validate.
Fix internal LV counter when a snapshot is removed.
Fix metadata corruption writing lvm1-formatted metadata with snapshots.
Add --prefixes to reporting tools for field name prefix output format.
Fix lvconvert -m0 allocatable space check.

View File

@ -439,7 +439,8 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
list_del(&lvl->list);
lv->vg->lv_count--;
if (!(lv->status & SNAPSHOT))
lv->vg->lv_count--;
} else if (lv->vg->fid->fmt->ops->lv_setup &&
!lv->vg->fid->fmt->ops->lv_setup(lv->vg->fid, lv))
return_0;

View File

@ -1177,6 +1177,7 @@ int vg_validate(struct volume_group *vg)
struct lv_list *lvl, *lvl2;
char uuid[64] __attribute((aligned(8)));
int r = 1;
uint32_t lv_count;
/* FIXME Also check there's no data/metadata overlap */
@ -1210,6 +1211,15 @@ int vg_validate(struct volume_group *vg)
r = 0;
}
if ((lv_count = (uint32_t) list_size(&vg->lvs)) !=
vg->lv_count + 2 * vg->snapshot_count) {
log_error("Internal error: #internal LVs (%u) != #LVs (%"
PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s",
list_size(&vg->lvs), vg->lv_count,
vg->snapshot_count, vg->name);
r = 0;
}
list_iterate_items(lvl, &vg->lvs) {
list_iterate_items(lvl2, &vg->lvs) {
if (lvl == lvl2)